Prev: dilation and erosion code
Next: Matlab code for BICM
From: Marton Buda on 1 Apr 2010 14:20 Hey, I'd like to plot velocity vectors for a set of ode's however the implementation makes me confused. I had a look at the following simple example: tspan = [0 10]; yazero = [1; 1]; ybzero = [-5; 2] ; yczero = [5; -2]; [ta, ya] = ode45(@pend, tspan, yazero); [tb, yb] = ode45(@pend, tspan, ybzero); [tc, yc] = ode45(@pend, tspan, yczero); [y1,y2] = meshgrid(-5:.5:5,-3:.5:3); Dy1Dt = y2; Dy2Dt = -sin(y1); quiver (y1,y2, Dy1Dt, Dy2Dt) -----function--- function yprime = pend(t,y) yprime = [y(2); -sin(y(1))]; -------------------- In my case the function file is slightly more complicated: function dydt = cact(t, y) dydt = zeros(size(y)); ea = 1.58; eb = 0.079; d = 15; p = 50; A = y(1); B = y(2); dydt(1) = d*(ea*((1+p*A^2)/(1+A^2+B^2))-A); dydt(2) = d*eb*((1+p*A^2)/(1+A^2))-B; If i simply put the expression into the code nothing is going to happen apart from getting a plane with the determined grid. Anyone has an idea how set of equations can be used with the command 'quiver'? Cheers, M.
|
Pages: 1 Prev: dilation and erosion code Next: Matlab code for BICM |