I can not plot values

5 Ansichten (letzte 30 Tage)
esat gulhan
esat gulhan am 7 Sep. 2020
Kommentiert: Stephan am 7 Sep. 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

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by