Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to convert symbolic expression and use solve function to solve equations

조회 수: 1 (최근 30일)
Xin CUI
Xin CUI 2016년 5월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
I used diff(fun,x) to find out analytically some equations. And I wanted to solve these equations using solve function. But I cannot get desirable solutions. Please help me point out what the problems are.
lambda=0.5;
Rbar=2; %R is R bar here;
Rb=1.4;
ro=2;
syms c1 ca cb gamma1 gamma2
e1= 2*lambda*c1^(1-ro)/(1-ro)+(1-lambda)*ca^(1-ro)/(1-ro)+ ...
(1-lambda)*cb^(1-ro)/(1-ro)+gamma1*(c1-cb)+gamma2*(cb-ca);
x1 = diff(e1,c1);
x2 = diff(e1,ca);
x3 = diff(e1,cb);
x4 = diff(e1,gamma1);
x5 = diff(e1,gamma2);
f1 = x1==0;
f2 = x2==0;
f3 = x3==0;
f4 = x4==0;
f5 = x5==0;
sol = solve([f1, f2, f3, f4, f5], [c1, ca, cb, gamma1, gamma2]);
% cSol = sol.c1;
% gammaSol = sol.gamma1;

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 25일
The solutions are:
ca = cb = c1 = +/- infinity
gamma1 = gamma2 = 0
but only if you allow "infinity - infinity == 0" to be true -- that is, if your "ca - cb == 0" is an expression for "ca == cb". Otherwise there is no solution. f1 and f2 together require that gamma1 and gamma2 be either 0 or opposite signs, and by the time the dust all settles they can only be 0.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by