Character vectors and strings in the first argument can only specify a variable or number.
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Alexi
il 11 Dic 2021
Commentato: Walter Roberson
il 12 Dic 2021
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?
0 Commenti
Risposta accettata
Walter Roberson
il 11 Dic 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 Commenti
Walter Roberson
il 12 Dic 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)
double(teta0rad)
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!