Hi all!
I have defined a function of mine in Matlab - Mathieu.m - and want to change it repeatedly from the command window. Does anyone know how to do this? Here's my case:
I want to solve an ODE containing an externally (from the command window) changing parameter (e.g. in a loop iteration):
The idea is now to set a vector p and a for-loop for k in the command window, so that the ODE is being solved in the k-th iteration with the parameter p(k).function dz = Mathieu(t,z,p,k)
%set dimensionless constants:
%E = v_F*q_c/W;
%F = -U_0/W;
E =1;
F =1;
%set ODE parameters a, Q%
a = (E*p(k)).^2;
Q = F*E*p(k).*exp(-p(k).^2);
%z_0 = [1;0]
dz = [-1i*a*z(2);-1i*(a+2*Q*cos(2*t))*z(1)];
Is there any way of doing this?
Thanks a lot for the help!