error Conversion to logical from sym is not possible.
이전 댓글 표시
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);
답변 (1개)
Cris LaPierre
2021년 1월 3일
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.
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!