









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










0 5 10 15 20 25 30 35
-0.
0
1
X axis description
Y axis description
Title for plot goes here
Legend for graph
Manually inserted text...
x=0:0.05:10pi; y=exp( -.1.x).*sin(x); plot(x,y) xlabel('X axis description') ylabel('Y axis description') title('Title for plot goes here') legend('Legend for graph') grid on
x=0:.02:1; y=x.^1.5; yr=randn(size(x)); yy=y+0.1.*yr; plot(x,yy,'x') p=polyfit(x,yy,1) p = 1.0159 -0. hold on plot(x,polyval(p,x),'r')
0 0.2 0.4 0.6 0.8 1 -0.
0
1
0 2 4 6 8
0
5
10
15
x=0:0.2:2.pi; y=sin(x); yr=randn(size(x)); plot(x,10.y+yr,'ro') hold on plot(x,10.*y)
X = 0.0:pi/100:2pi; Y1 = cos (X); Y2 = 3cos (X); Y3 = cos(2*X); Y4 = sin(X);
plot(X,Y1) hold on plot(X,Y2) plot(X,Y3) plot(X,Y4)
-3 0 1 2 3 4 5 6 7
0
1
2
3
-3 0 1 2 3 4 5 6 7
0
1
2
3
plot(X,Y1,X,Y2,X,Y3,X,Y4)
plot(X,Z)
-3 0 1 2 3 4 5 6 7
0
1
2
3
plot(X, Z, 'o')
x=0:0.1:3.pi; y1=sin(x+0.5); y2=90.sin(x-0.5); plotyy(x,y1,x,y2)
0 2 4 6 8 10
-0.
0
1
0 2 4 6 8 10
0
50
100
0 2 4 6 8 10
0
50
100
x=0:0.1:3.pi; y1=sin(x+0.5); y2=90.sin(x-0.5); plot(x,y1,x,y2)
f(x)
x
0 2 4 6 8 10 12 14 16
0
5
x
y
[x,y]=evaluate('trig',0,5.*pi,100);
plot(x,y), xlabel('x'), ylabel ('y')
-0.5 0 0.5 1 1.5 2
0
20
40
60
80
100
x
y
x=-0.5:0.05:2;
y=humps(x); plot(x,y), xlabel('x'), ylabel ('y')
-0.5 0 0.5 1 1.5 2
0
20
40
60
80
100
x
y
x=-0.5:0.05:2; y=humps(x); plot(x,y), xlabel('x'), ylabel('y')
[x,y]=fminbnd ('humps', 0.4, 1.0) x =
y =
hold on plot(x,y,'ro')
copy into function workspace and modify
help ode
ODE45 Solve non-stiff differential equations, medium order method. [T,Y] = ODE45(ODEFUN,TSPAN,Y0) with TSPAN = [T0 TFINAL] inte grates the system of differential equations y' = f(t,y) from time T0 to TFINAL with initial conditions Y0. Function ODEFUN(T,Y) must return a co lumn vector corresponding to f(t,y). Each row in the solution array Y co rresponds to a time returned in the column vector T. To obtain solutions at specific times T0,T1,...,TFINAL (all increasing or all decreasing), u se TSPAN = [T0 T1 ... TFINAL].
(truncated)
2 ( )^22
y y
y g t^ ζy^ y
(^) ′ = ′ (^) −^ −
[ tt,yy]= ode45 ('rhs', [0 35],[1 0]'); whos Name Size Bytes Class
tt 205x1 1640 double array yy 205x2 3280 double array
Grand total is 615 elements using 4920 bytes
plot(tt,yy(:,1))
1 2