Character vectors and strings in the first argument can only specify a variable or number.

2 visualizaciones (últimos 30 días)
Character vectors and strings in the first argument can only specify a variable or number.
To evaluate character vectors and strings representing symbolic expressions, use str2sym
Tmr=3728;
Amr=932;
rho=0.002378;
Ohm=36;
Rmr=17.22;
smr=0.034;
Cla_d=0.11;
Cla_r=Cla_d/0.01745;
a=1131.55;
bmr=2;
CTreq=Tmr/(rho*Amr*(Ohm*Rmr)^2);
tetatwdeg=-12;
tetatwrad=tetatwdeg*0.01745;
for i=1:1:12
if i==1
teta0rad=(6*CTreq/(smr*Cla_r))-(0.75*tetatwrad+(0.75*sqrt(2)*sqrt(CTreq)));
else
teta0rad=(6*CTreq/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CTreq/2)));
end
myEqn = sym('teta0rad =(6*CT/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CT/2)))');
newEqn = subs(myEqn,{'teta0rad','smr','Cla_r','tetatwrad'}, [teta0rad,smr,Cla_r,tetatwrad]);
CTi=solve(newEqn);
teta0rad=teta0rad+(6*(CTreq-CTi)/(smr*Cla_r))+(0.75*sqrt(2)*(sqrt(CTreq)-sqrt(CTi)));
end
Why do I get that error?

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Dic. de 2021
change
myEqn = sym('teta0rad =(6*CT/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CT/2)))');
newEqn = subs(myEqn,{'teta0rad','smr','Cla_r','tetatwrad'}, [teta0rad,smr,Cla_r,tetatwrad]);
to
syms CT
newEqn = teta0rad == (6*CT/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CT/2))));
  3 comentarios
Walter Roberson
Walter Roberson el 12 de Dic. de 2021
Tmr=3728;
Amr=932;
rho=0.002378;
Ohm=36;
Rmr=17.22;
smr=0.034;
Cla_d=0.11;
Cla_r=Cla_d/0.01745;
a=1131.55;
bmr=2;
CTreq=Tmr/(rho*Amr*(Ohm*Rmr)^2);
tetatwdeg=-12;
tetatwrad=tetatwdeg*0.01745;
for i=1:1:12
if i==1
teta0rad=(6*CTreq/(smr*Cla_r))-(0.75*tetatwrad+(0.75*sqrt(2)*sqrt(CTreq)));
else
teta0rad=(6*CTreq/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CTreq/2)));
end
syms CT
newEqn = teta0rad == (6*CT/(smr*Cla_r))-(0.75*tetatwrad+(1.5*sqrt(CT/2)));
CTi=solve(newEqn);
teta0rad=teta0rad+(6*(CTreq-CTi)/(smr*Cla_r))+(0.75*sqrt(2)*(sqrt(CTreq)-sqrt(CTi)));
end
simplify(teta0rad)
ans = 
double(teta0rad)
ans = 0.2094

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by