error Conversion to logical from sym is not possible.
Afficher commentaires plus anciens
i dont know how to solve that error
here is my code
clc;
clear all;
syms k ;
wo= input('write omega node = ');
% 100;
Mm=input('write motorcycle mass = ');
% 200;
Md=input('write diver mass = ');
% 80;
m=Mm+Md;
cp=input('write Cp = ');
% 0.1;
z=input('write zeita = ');
% 0.6;
i=0;
yo=input('wirte y node value = ');
for M=Mm+40:1:m
i=i+1;
f=((sqrt((k*yo)^2+(2*M*z*sqrt(k/M)*wo*yo)^2)/k)...
*(1/sqrt((1-(wo/sqrt(k/M))^2)^2+(2*z*(wo/sqrt(k/M)))^2)))-cp;
K(:,i)=vpa(solve(f));
r=wo/sqrt(k/m);
end
r=wo/sqrt(k/m);
if r>=1
return
end
C=2*m*z*sqrt(K/m);
M=Mm+40:1:m;
figure(1)
plot(M,K);
figure(2)
plot(M,C);
Réponses (1)
Cris LaPierre
le 3 Jan 2021
The issue is with this line of code
if r>=1
Your variable r is a symbolic expression made up of symbolic variables. Therefore, this comparison can't be performed.
You would need to use subs to replace your symbolic variables with values, then use double to convert the symbolic variable to a double.
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!