MATLAB Answers

0

I'm getting only complex solutions for an numerically solved (vpasolve) equation, but when plotting the equations I do find a real solution. How can I tell MATLAB to give me that real solution?

Asked by Roy Ramirez on 24 Aug 2019
Latest activity Commented on by Roy Ramirez on 24 Aug 2019
Code:
%inputs
k = 1.2;
P2 = 12.55; %psi
P3 = 12.55;
F = 50; %N
A2 = 0.000594389; %m2
At = 0.000253514; %m2
%variables
a = (P2*6894.757)^((k-1)/k)
b = (k+1)/k
c = ((F+2*6894.757*(P3-P2)*A2)/(At*sqrt((2*(k^2)/(k-1))*((2/(k+1))^((k+1)/(k-1))))))^2
%Plot Graphs
syms x clear
eqnLeft = x^2-a*(x^b);
eqnRight = c;
fplot([eqnLeft eqnRight])
xlim([-1000000 1000000])
ylim([-100 10*(10^9)])
%solve
sol = vpasolve(eqnLeft == eqnRight,x)

  2 Comments

sol = vpasolve(eqnLeft == eqnRight,x,[2.2e5 2.4e5])

Sign in to comment.

Tags

0 Answers