I can not plot values

1 回表示 (過去 30 日間)
esat gulhan
esat gulhan 2020 年 9 月 7 日
コメント済み: Stephan 2020 年 9 月 7 日
When i try to plot results, plot is blank. I want to plot this a line.
syms Frx B m V1 V2 P1g P2g Frz alfa1 alfa2 A1 V M Degree Fr W Weight
m1=18;B1=1;P1g=0;V1=250;A1=1;alfa1=0;
m2=m1;B2=B1;P2g=0;V2=250;A2=1;Weight=0;
alfa2=0;
eq1=-Frx+P1g*A1==B2*m2*V2*cosd(alfa2) -B1*m1*V1*cosd(alfa1);
Frx=vpa(solve(eq1,Frx),10)
for alfa2=linspace(0,180,100)
plot(alfa2,Frx)
end

採用された回答

Stephan
Stephan 2020 年 9 月 7 日
編集済み: Stephan 2020 年 9 月 7 日
syms Frx B m V1 V2 P1g P2g Frz alfa1 A1 V M Degree Fr W Weight
m1=18;B1=1;P1g=0;V1=250;A1=1;alfa1=0;
m2=m1;B2=B1;P2g=0;V2=250;A2=1;Weight=0;
alfa2=linspace(0,180,100);
eq1=-Frx+P1g*A1==B2*m2*V2*cosd(alfa2) -B1*m1*V1*cosd(alfa1);
% preallocate
Frx_num = zeros(1,numel(alfa2));
% solve in a loop --> VPA does not make sense, because for plot
% you have to convert to double
for k = 1:numel(alfa2)
Frx_num(k)=(solve(eq1(k),Frx));
end
% convert to double
Frx_num = double(Frx_num);
% plot
plot(alfa2,Frx_num)
  3 件のコメント
Steven Lord
Steven Lord 2020 年 9 月 7 日
You can try to solve once then substitute values for alfa2 into the solution using subs.
Stephan
Stephan 2020 年 9 月 7 日
syms Frx B m V1 V2 P1g P2g Frz alfa1 alfa2 A1 V M Degree Fr W Weight
m1=18;B1=1;P1g=0;V1=250;A1=1;alfa1=0;
m2=m1;B2=B1;P2g=0;V2=250;A2=1;Weight=0;
eq1=-Frx+P1g*A1==B2*m2*V2*cosd(alfa2) -B1*m1*V1*cosd(alfa1);
% You want it faster
eq1_num = matlabFunction(rhs(isolate(eq1,Frx)),'Vars',{'alfa2'});
fplot(eq1_num,[0,180])

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by