I can not plot values

5 visualizzazioni (ultimi 30 giorni)
esat gulhan
esat gulhan il 7 Set 2020
Commentato: Stephan il 7 Set 2020
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

Risposta accettata

Stephan
Stephan il 7 Set 2020
Modificato: Stephan il 7 Set 2020
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 Commenti
Steven Lord
Steven Lord il 7 Set 2020
You can try to solve once then substitute values for alfa2 into the solution using subs.
Stephan
Stephan il 7 Set 2020
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])

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by