MATLAB Answers

Getting Empty sym: 0-by-1 when using solve function

1 view (last 30 days)
paDideh
paDideh on 23 Oct 2020
Commented: Star Strider on 24 Oct 2020
Hello!
I have a system of 5 nonlinear equations(eq1...eq5) that I try to solve with solve but ,The answer I get is: "Empty sym: 0-by-1" for all variables, my descision variables are "w,Po,Pr,An,Al,Mu" and another are constant parameters.
in addition i got this "Warning: Cannot find explicit solution.> In solve (line 316) ",i am beginner in matlab and cant solve this problem. Can anybody help me?
syms Rho bo br beta delta gamma c alpha Phi Eta K w %parameters
syms w Po Pr An Al Mu S %decision variables
Pr =(delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho);
Al =(delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2;
eq1 =Phi*S + K*alpha - Po*bo - (Po - c)*(bo + Rho*((2*Rho - 2*Mu*Rho)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + 1) - (Rho*delta^2*gamma*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) + An^(1/2)*beta - (c - w)*(Rho*((2*Rho - 2*Mu*Rho)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + 1) + (br*(2*Rho - 2*Mu*Rho))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (Rho*delta^3*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) + gamma*((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2) - Rho*(Po - (delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)) - (2*Mu*Rho*delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2
eq2 =An^(1/2)*beta - alpha*(K - 1) + (Po - c)*((Rho*(delta^2 - 2*Rho - 2*br + 2*Mu*br + 2*Mu*Rho))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) - (delta^2*gamma*(Rho + br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) + (c - w)*((Rho*(delta^2 - 2*Rho - 2*br + 2*Mu*br + 2*Mu*Rho))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (br*(delta^2 - 2*Rho - 2*br + 2*Mu*br + 2*Mu*Rho))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (delta^3*(Rho + br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) + delta*((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2) + Rho*(Po - (delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)) - (br*(delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (2*Mu*delta^2*(Rho + br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2
eq3 =(Po - c)*(beta/(2*An^(1/2)) - (Rho*(beta/An^(1/2) - (Mu*beta)/An^(1/2)))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (beta*delta^2*gamma*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(2*An^(1/2)*((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) - (c - w)*(beta/(2*An^(1/2)) + (Rho*(beta/An^(1/2) - (Mu*beta)/An^(1/2)))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (br*(beta/An^(1/2) - (Mu*beta)/An^(1/2)))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) + (beta*delta^3*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(2*An^(1/2)*((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)) - (Mu*beta*delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta))/(An^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2) - 1
eq4 =(Rho*((2*Po*Rho + 2*K*alpha + 2*Rho*w + 2*br*w + 2*An^(1/2)*beta)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) - ((4*Rho + 4*br)*(delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2) - (delta^2*gamma*(4*Rho + 4*br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^3))*(Po - c) + (c - w)*(Rho*((2*Po*Rho + 2*K*alpha + 2*Rho*w + 2*br*w + 2*An^(1/2)*beta)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) - ((4*Rho + 4*br)*(delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2) + (br*(2*Po*Rho + 2*K*alpha + 2*Rho*w + 2*br*w + 2*An^(1/2)*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho) - (br*(4*Rho + 4*br)*(delta^2*w - 2*K*alpha - 2*Rho*w - 2*br*w - 2*An^(1/2)*beta - 2*Po*Rho + 2*Mu*Po*Rho + 2*K*Mu*alpha + 2*Mu*Rho*w + 2*Mu*br*w + 2*An^(1/2)*Mu*beta))/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2 + (delta^3*(4*Rho + 4*br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(((delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2)^(1/2)*(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^3)) - (delta^2*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^2 + (2*Mu*delta^2*(4*Rho + 4*br)*(Po*Rho + K*alpha - Rho*w - br*w + An^(1/2)*beta)^2)/(delta^2 - 4*Rho - 4*br + 4*Mu*br + 4*Mu*Rho)^3
eq5 =Phi*(Po - c) - Eta*S
Ans=solve(eq1,eq2,eq3,eq4,eq5,Po,w,An,S,Mu);

  0 Comments

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 23 Oct 2020
Edited: Star Strider on 23 Oct 2020
First, ‘[M1,M2,M3,M4,M5,]’ do not exist anywhere, so please do not refer to them.
Second, the correct syntax for solve is:
Ans=solve([eq1,eq2,eq3,eq4,eq5],[Po,w,An,S,Mu]);
My computer is currently ‘Busy’ attempting to run that, so I have no results to post. If it finishes in a few minutes (rather than my stopping it to do other things), I will post the results.
EDIT — (23 Oct 2020 at 17:51)
The Symbolic Math Toolbox cannot find a solution for any of those variables.

  2 Comments

paDideh
paDideh on 24 Oct 2020
many thanks, i changed equations name to eq1,... . ii correct the code and write your suggestion,(Ans=solve([eq1,eq2,eq3,eq4,eq5],[Po,w,An,S,Mu]);) .
but stil the result is same as before: Empty sym: 0-by-1
Usualy i solve system of equation by this method (using solve), but dont know why this one get such result :(
Star Strider
Star Strider on 24 Oct 2020
There apparently is no analytic solution.
You might be able to do this numerically, depending on the result you want, so see if the Optimization Toolbox functions will do what you want.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!