I am trying to solve a variable in an equation (syms x), I've simplified the equation. I am trying to store the value in P_9, a 1x1000 matrix by converting from a symbol to a double and am getting the error below. It is giving me a symbol of 0x0, which is where I think my error lies.
Please help me troubleshoot my code. Many thanks!
number = 1000;
P_9 = zeros(1,number);
A_t=0.67;
A_e = linspace(0,10,number);
for n=1:number
%% find p9
syms x
eqn = x + 5 == A_t/A_e(n);
solx = solve(eqn,x);
P_9(n) = double(solx);
end
Warning: Explicit solution could not be found.
In solve at 179 In HW4 at 74 In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in HW4 (line 76) P_9(n) = double(solx);
xin your equation, you could perhaps use an iterative methode to found the x value (like the fixed point method). So instead of using an analytical methode, try to use a numerical method. But did your error come from this exact code ? Because in this case the equation is explicit ! - obchardonvpasolve, so it should work now. - obchardon