mathlab, don't want debug this programme
3 views (last 30 days)
I need your help with respect to a program that does not want to debug ... could enlighten me on the problem, I'll be very grateful
%Fonction qui calcule la dérivée de x
function [ddelta domega dQ dpsiF dpsiq1 dvf] = derivative (t, x)
%introduction des paramètres
XqPrime = 0.25;
ddelta = omega - omegaN; %1
domega = (omegaN)^2 *(Tm-Te)/(2*H); %2
dpsiq1 = (-Rq1iq1)*omegaN;%8
[T,X] =ode45(@derivative,[0 20],[0.55 317 0.81 2530 40.6 1.63]);
ChristianW on 2 Mar 2013
Do you have the last line in a different m-file with a clear all at start? If so, clear all clears also breakpoints, try only clear without all.
Image Analyst on 3 Mar 2013
The only time I've seen a program not let you debug it is when there is a syntax error somewhere in the file. So look for the error message or the little red line in the right margin to locate the syntax error and fix it.
Cedric Wannaz on 3 Mar 2013
Edited: Cedric Wannaz on 3 Mar 2013
You must have your function in an M-file called derivative.m without the call to ODE45, and make the latter from the command window or from another M-file. If you have the file derivative.m open in the editor, put the cursor on line 3 ( delta=x(1)) and press F12 to set a break point. Then, execute the call to ODE45 from the command window for example:
>> [T,X] = ode45(@derivative, [0 20], [0.55 317 0.81 2530 40.6 1.63]) ;
and you will see the debugger entering the function and stopping at line 3 (indicated with a green arrow).
I tested this bit and it worked perfectly. Now based on your work with the debugger (or by reading the error message that you get when you make the call to ODE45), you will realize that you have at least an issue with the length of your derivative (=1 when the initial condition has length 6).