You are on page 1of 4

Q=quad('fx',0,.

8)

>> x=[0 .12 .22 .32 .36 .4 .44 .54 .64 .7 .8];
>> y=fx(x)

>> integral=trapz(x,y)

>> diff(x)

>> d=diff(y)./diff(x)

>> a=[ 1 1/2 1/3 ; 1 2/3 2/4 ; 1 3/4 3/5 ]

>> b=[1+1/2+1/3;1+2/3+2/4;1+3/4+3/5]

>> cond(a)

>> X=a\b

>> X=inv(a)*b

>> tspan = [0,20];


>> y0=[2,1];
>>
[t,y]=ode23('predprey',tspan,y0);
>> plot(t,y)

>> plot(y(:,1),y(:,2))

>> tspan = [0,20];


>> y0=[1,1];
>> [t,y]=ode45('vanderpol',tspan,y0);
>> plot(t,y(:,1))

function yp = vanderpol(t,y)
yp=[y(2);1000*(1y(1)^2)*y(2)-y(1)];

>> tspan=[0,3000];
>> y0=[1,1];
>>

[t,y]=ode23s('vanderpol',tspan,y0);
>> plot(t,y(:,1))

>> clear, clf, hold off


>> x1 = 0:0.1:2;
>> y1 = -2:0.1:2;
>> [x,y] = meshgrid(x1,y1);
>> f1 = f_f1(x,y);

>> clear, clf, hold off


>> x1 = 0:0.1:2;
>> y1 = -2:0.1:2;
>> [x,y] =
meshgrid(x1,y1);
>> f1 = f_f1(x,y);
>> f2 = f_f2(x,y);
>> contour(x1,y1,f1,
[0.00, 0.00])
>> hold on
>> contour(x1,y1,f2,
[0.00, 0.00])
>> xlabel (x) ; ylabel (y)

You might also like