sin(3.1415926)
ans =
5.3590e-008
cos(3.1415926)
ans =
-1.0000
format long
cos(3.1415926)
ans =
-0.999999999999999
pi
ans =
3.141592653589793
sin(pi)
ans =
1.224646799147353e-016
help sin
SIN Sine of argument in radians.
SIN(X) is the sine of the elements of X.
See also asin, sind.
Overloaded methods:
codistributed/sin
Reference page in Help browser
doc sin
who
Your variables are:
ans
s=sin(3.1)
s =
0.041580662433290
who
Your variables are:
ans s
whos
Name Size Bytes Class Attributes
ans 1x1 8 double
s 1x1 8 double
A = [1,2 ;2,1]
A =
1 2
2 1
whos
Name Size Bytes Class Attributes
A 2x2 32 double
ans 1x1 8 double
s 1x1 8 double
exp(A)
ans =
2.718281828459046 7.389056098930650
7.389056098930650 2.718281828459046
log(exp(A))
ans =
1 2
2 1
A*A
ans =
5 4
4 5
A.*A
ans =
1 4
4 1
A'
ans =
1 2
2 1
inv(A)
ans =
-0.333333333333333 0.666666666666667
0.666666666666667 -0.333333333333333
b=[2;3]
b =
2
3
x=inv(A)*b
x =
1.333333333333334
0.333333333333333
A*x
ans =
2
3
A*x-b
ans =
0
0
uiopen('C:\Users\uwer\Documents\MATLAB\V1\HelloWorld.m',1)
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
HelloWorld
Hello World
Hello World
Geben Sie den Radius r ein: r = 2
Die Fläche eines Kreises mit Radius 2.000000 beträgt 12.566371
Das Volumen einer Kugel mit Radius 2.000000 beträgt 33.510322
uiopen('C:\Users\uwer\Documents\MATLAB\V1\HelloWorld.m',1)
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
HelloWorld
Hello World
Hello World
Geben Sie den Radius r ein: r = 2
Die Fläche eines Kreises mit Radius 2.000000 beträgt 12.566371
Das Volumen einer Kugel mit Radius 2.000000 beträgt 33.510322
pi =1.
pi =
1
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
HelloWorld
Hello World
Hello World
Geben Sie den Radius r ein: r = 2
Die Fläche eines Kreises mit Radius 2.000000 beträgt 4.000000
Das Volumen einer Kugel mit Radius 2.000000 beträgt 10.666667
uiopen('C:\Users\uwer\Documents\MATLAB\V1\HelloWorld.m',1)
uiopen('C:\Users\uwer\Documents\MATLAB\V1\SimpleDemo.m',1)
SimpleDemo(2)
ans =
12.566370614359172
[A,V]=SimpleDemo(2)
A =
12.566370614359172
V =
33.510321638291124
pi
pi =
1
r2
{??? Undefined function or variable 'r2'.
}
help HelloWorld
Hello World Programm
help SimpleDemo
Berechne Fläche und Volumen von Kugel bzw. Kreis bei
vorgegebenem Radius
Input: r Radius
Output: [Fläche Volumen]
uiopen('C:\Users\uwer\Documents\MATLAB\V1\AreaAndVolume.m',1)
uiopen('C:\Users\uwer\Documents\MATLAB\V1\ProgrammFluss.m',1)
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
ProgrammFluss
0.100000 0.010000
1.100000 1.210000
2.100000 0.226757
3.100000 0.104058
4.100000 0.059488
5.100000 0.038447
6.100000 0.026874
7.100000 0.019837
8.100000 0.015242
9.100000 0.012076
x=0:pi/20:6*pi
x =
Columns 1 through 2
0 0.050000000000000
Columns 3 through 4
0.100000000000000 0.150000000000000
Columns 5 through 6
0.200000000000000 0.250000000000000
Columns 7 through 8
0.300000000000000 0.350000000000000
Columns 9 through 10
0.400000000000000 0.450000000000000
Columns 11 through 12
0.500000000000000 0.550000000000000
Columns 13 through 14
0.600000000000000 0.650000000000000
Columns 15 through 16
0.700000000000000 0.750000000000000
Columns 17 through 18
0.800000000000000 0.850000000000000
Columns 19 through 20
0.900000000000000 0.950000000000000
Columns 21 through 22
1.000000000000000 1.050000000000000
Columns 23 through 24
1.100000000000000 1.150000000000000
Columns 25 through 26
1.200000000000000 1.250000000000000
Columns 27 through 28
1.300000000000000 1.350000000000000
Columns 29 through 30
1.400000000000000 1.450000000000000
Columns 31 through 32
1.500000000000000 1.550000000000000
Columns 33 through 34
1.600000000000000 1.650000000000000
Columns 35 through 36
1.700000000000000 1.750000000000000
Columns 37 through 38
1.800000000000000 1.850000000000000
Columns 39 through 40
1.900000000000000 1.950000000000000
Columns 41 through 42
2.000000000000000 2.050000000000000
Columns 43 through 44
2.100000000000000 2.150000000000000
Columns 45 through 46
2.200000000000000 2.250000000000000
Columns 47 through 48
2.300000000000000 2.350000000000000
Columns 49 through 50
2.400000000000000 2.450000000000000
Columns 51 through 52
2.500000000000000 2.550000000000000
Columns 53 through 54
2.600000000000000 2.650000000000000
Columns 55 through 56
2.700000000000000 2.750000000000000
Columns 57 through 58
2.800000000000000 2.850000000000000
Columns 59 through 60
2.900000000000000 2.950000000000000
Columns 61 through 62
3.000000000000000 3.050000000000000
Columns 63 through 64
3.100000000000000 3.150000000000000
Columns 65 through 66
3.200000000000000 3.250000000000000
Columns 67 through 68
3.300000000000000 3.350000000000000
Columns 69 through 70
3.400000000000000 3.450000000000000
Columns 71 through 72
3.500000000000000 3.550000000000000
Columns 73 through 74
3.600000000000000 3.650000000000000
Columns 75 through 76
3.700000000000000 3.750000000000000
Columns 77 through 78
3.800000000000000 3.850000000000000
Columns 79 through 80
3.900000000000000 3.950000000000000
Columns 81 through 82
4.000000000000000 4.050000000000000
Columns 83 through 84
4.100000000000000 4.150000000000000
Columns 85 through 86
4.200000000000000 4.250000000000000
Columns 87 through 88
4.300000000000000 4.350000000000000
Columns 89 through 90
4.400000000000000 4.450000000000000
Columns 91 through 92
4.500000000000000 4.550000000000000
Columns 93 through 94
4.600000000000000 4.650000000000000
Columns 95 through 96
4.700000000000000 4.750000000000000
Columns 97 through 98
4.800000000000000 4.850000000000000
Columns 99 through 100
4.900000000000000 4.950000000000000
Columns 101 through 102
5.000000000000000 5.050000000000000
Columns 103 through 104
5.100000000000000 5.150000000000000
Columns 105 through 106
5.200000000000000 5.250000000000000
Columns 107 through 108
5.300000000000000 5.350000000000000
Columns 109 through 110
5.400000000000000 5.450000000000000
Columns 111 through 112
5.500000000000000 5.550000000000000
Columns 113 through 114
5.600000000000000 5.650000000000000
Columns 115 through 116
5.700000000000000 5.750000000000000
Columns 117 through 118
5.800000000000000 5.850000000000000
Columns 119 through 120
5.900000000000000 5.950000000000000
Column 121
6.000000000000000
x=0:pi/20:6*pi;
plot(x,exp(-0.2*x).*sin(x),'g')
pi=10
pi =
10
x=0:pi/20:6*3.14159;
plot(x,exp(-0.2*x).*sin(x),'g')
diary off