필터 지우기
필터 지우기

Output Management

조회 수: 3 (최근 30일)
mkeehan
mkeehan 2011년 7월 18일
Hi!
I am asking matlab to do this:
iP = 0; % this is a cell in the dark
iSat = 1e-8;
rS = .5;
rSh = 300;
n = 20000;
subTotal = solve('iP - iSat * (exp(38.66976*(x+dcellCurrent(1)*rS)/n)-1) -(dcellCurrent(1)*rS + x)/rSh - dcellCurrent(1) = 0',x)
So, I have asked it to print the value of x and store the value of x in subTotal, yes?
But when it prints, it says:
subTotal =
iP*rSh - 1.0*rSh*dcellCurrent(1) - 1.0*rS*dcellCurrent(1) + iSat*rSh - 0.025860000165504001059225606779044*n*lambertw(0, (120843*iSat*rSh*exp((120843*rS*dcellCurrent(1))/(3125*n))*exp((120843*rSh*(iP + iSat - dcellCurrent(1) - (rS*dcellCurrent(1))/rSh))/(3125*n)))/(3125*n))
All I want it to print is the number, not the constants and such.
How do I go about changing the output from an expression to a simple number?
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2011년 7월 18일
what's dcellCurrent?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 7월 18일
Leave out the '' around the expression, and leave out the = 0
subTotal = solve(iP - iSat * (exp(38.66976*(x+dcellCurrent(1)*rS)/n)-1) -(dcellCurrent(1)*rS + x)/rSh - dcellCurrent(1), x);
  댓글 수: 2
mkeehan
mkeehan 2011년 7월 19일
After doing so, it says:
Warning: List of equations is empty.
> In solve at 70
In transcendentalTesting at 19
??? Error using ==> mupadmex
Error in MuPAD command: Either base or exponent must be a scalar.
Error in ==> sym.sym>sym.mpower at 207
B = mupadmex('symobj::mpower',A.s,p.s);
Error in ==> transcendentalTesting at 19
subtotal = (solve(iP - iSat * (exp(38.66976*(x+dcellCurrent(1)*rS)/n)-1) -(dcellCurrent(1)*rS + x)/rSh -
dcellCurrent(1),x)-dcellVoltage(1))^2 ;
Comments?
Walter Roberson
Walter Roberson 2011년 7월 19일
Make sure you
syms x
before executing the solve.
double() around the solve() call, and use .^2 instead of ^2

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by