필터 지우기
필터 지우기

Indexing error using ezplot

조회 수: 1 (최근 30일)
random09983492
random09983492 2012년 8월 7일
Hi, I'm writing a code that uses symbolic variables and ezplot. My equation contains 17 variables, and I am trying to find the derivative with respect to 16 of the 17 variables. I'm not sure if I'm approaching this the correct way. My current code takes the derivative of the equation, then I use the subs command to put in values for the other variables, then use ezplot to show the derivative. Here's a portion of my code:
syms gamma02 gamma13 Gamma02 Gamma13 tau02 tau13 Omega02 Omega13 ...
Phi02 Phi13 gamma02_1 gamma13_1 t;
gamma02 = Gamma02*cos(2*pi*tau02*t+Omega02)+Phi02;
gamma02_1 = Gamma02*cos(Omega02)+Phi02;
gamma13 = Gamma13*sin(2*pi*tau13*t+Omega13)+Phi13;
gamma13_1 = Gamma13*sin(Omega13)+Phi13;
syms Gamma02_e Gamma13_e tau02_e tau13_e Omega02_e Omega13_e Phi02_e Phi13_e psi;
U = Gamma13_e/Gamma02_e*(gamma02_1-Phi02_e)*exp(-1i*(Omega13_e-Omega02_e))+1i*(gamma13_1-Phi13_e);
theta_offset = 2*atan((sqrt(real(U).^2+imag(U).^2)-real(U))./imag(U));
U = (Gamma13_e/Gamma02_e*(gamma02-Phi02_e)*exp(-1i*(Omega13_e-Omega02_e))+1i*(gamma13-Phi13_e))*exp(1i*-theta_offset);
theta = 2*atan((sqrt(real(U).^2+imag(U).^2)-real(U))./imag(U));
syms theta_ref theta_err theta_err_rms;
theta_ref = atan(sin(2*pi*tau13*t),cos(2*pi*tau02*t));
theta_err = theta - theta_ref;
theta_err_rms = sqrt(mean(theta_err.^2));
syms dGamma02 dtau02 dOmega02 dPhi02;
dGamma02 = diff(theta_err_rms,'Gamma02');
dtau02 = diff(theta_err_rms,'tau02');
dOmega02 = diff(theta_err_rms,'Omega02');
dPhi02 = diff(theta_err_rms,'Phi02');
dGamma02 = subs(dGamma02,{Gamma02,Gamma13,Gamma13_e,tau02,tau02_e,tau13,tau13_e,Omega02,Omega02_e,Omega13,Omega13_e,Phi02,Phi02_e,Phi13,Phi13_e,t},{1,1,1,1/22,1/22,1/22,1/22,0,0,0,0,0,0,0,0,1});
ezplot(dGamma02);
As you can see, I take the derivative with respect to Gamma02, and that is the only variable I don't substitute with a number. The error I receive is this:
Error: ()-indexing must appear last in an index expression.
Error in ==> inline.feval at 36
INLINE_OUT_ = inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> ezplotfeval at 54
z = feval(f,x(1),y(1));
Error in ==> ezplot>ezimplicit at 258
u = ezplotfeval(f, X, Y);
Error in ==> ezplot at 155
hp = ezimplicit(cax, f{1}, vars, labels, args{:});
Error in ==> sym.ezplot at 45
h = ezplot(char(f));
I'm not too familiar with using symbolic variables, so maybe I am overlooking something simple. Thanks for the help.
Entire code uploaded to pastebin: http://pastebin.com/ktxUvm6L
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2012년 8월 8일
What does char(f) evaluate to?
Oleg Komarov
Oleg Komarov 2012년 8월 8일
I don't any problems on R2012a Win Xp 32b

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by