Code covered by the BSD License  

Highlights from
Chebpack

image thumbnail

Chebpack

by

 

15 Jul 2011 (Updated )

The MATLAB package Chebpack solves specific problems for differential or integral equations.

Ex4_delay_fig.m
% use: Ex4_delay_fig;
load('BIFref');
[n,m]=size(B);n=n-2;
figure(1);
subplot(2,2,2);plot(B(n+2,:),B(n+1,:),'.');
xlabel('\lambda');ylabel('Period');grid;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=1:m,nm(k)=norm(B(1:n,k));end;
subplot(2,2,1);plot(B(n+2,:),nm,'.');
xlabel('\lambda');ylabel('||x|| _2');grid;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I= find(abs(B(n+2,:)-3.4)<0.001);B(n+2,I);D=deriv(n,[0,1]);I
for k=1:3
    solnum(:,k)=t2x(B(1:n,I(k)),2);
    t=pd(n,[0 1],2);tt(:,k)=B(n+1,I(k))*t;
    s(:,k)=linspace(0,1,500).*B(n+1,I(k));
    dsolnum(:,k)=t2x(D*B(1:n,I(k))/B(n+1,I(k)),2);
    plotsol(:,k)=barycheb(s(:,k),solnum(:,k),tt(:,k),2);
    plotdsol(:,k)=barycheb(s(:,k),dsolnum(:,k),tt(:,k),2);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1);
subplot(2,2,3);plot(s,plotsol);xlabel('t');ylabel('x_1, x_2, x_3');
grid;legend('x_1','x_2','x_3');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2);
plot(tt,dsolnum);xlabel('t');ylabel('x''_1, x''_2, x''_3');
grid;legend('x''_1','x''_2','x''_3');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1);
subplot(2,2,4);plot(plotsol,plotdsol);xlabel('x');ylabel('x''');
grid;legend('x_1','x_2','x_3');

Contact us