image thumbnail

MATLAB 5.x, SIMULINK 2.x: poradnik uzytkownika

by

 

22 Aug 2002 (Updated )

Companion Software

vdp2n_m5.m
%-----------------------------------------------------------------
% Copyright 1998, by Bogumila and Zbigniew Mrozek, Krakow. For use
% with the book "MATLAB 5.x, SIMULINK 2.x, poradnik uzytkownika"
% (PLJ Warszawa, 1998,  ISBN 83-7101-376-0).
%-----------------------------------------------------------------
% see page 300, chapter 12.2.4 of the book,      'file vdp2n.m'
% running simulation from MATLAB Command Window: model vdp2n.mdl
%Symulacja modelu oscylatora nieliniowego Van der Pola

x0= [0; 2.3]; %warunki poczatkowe [x dx/dt] dla t=0
tf=40;        %Koncowy czas symulacji
options = simset('InitialState',x0);
[t,x] = sim('vdp2n',tf,options);    %symulacja

subplot(2,1,1),  plot(t,x(:,1),'-',t,x(:,2),'-.')
title(['dx^{2}/dt^{2} + \omega^{2}*sin(x) =',...
       '\mu*(1 - (b*sin(x))^{2})*dx/dt '])

subplot(2,1,2), plot(x(:,1),x(:,2),x0(1),x0(2),'ro')
title('Wykres fazowy: dx/dt = f(x)')
xlabel('x');  ylabel('dx/dt')

Contact us