Wednesday, March 2, 2011

matlab solve

http://www.mathworks.com/help/toolbox/symbolic/solve.html
-----------------------------------------------------------------

>> syms x y
>> result=solve('exp(x)*y-ln(y)*x=0','x=y+1')
result =
    x: [1x1 sym]
    y: [1x1 sym]
>> result.x

ans =

-.212155361430993006577644044280e-1+.38291443398311495554475294629891*i


>> result.y

ans =

-1.0212155361430993006577644044280+.38291443398311495554475294629891*i
----------------------------------------------------------------------------------------------
>> syms x y
>> result=solve('exp(x)*y-ln(y)*x=0','y')

result =

-1/exp(x)*x*lambertw(-exp(x)/x)

>>clear all;
>> x=linspace(-10,10,1000);
>> y = -1./exp(x).*x.*lambertw(-exp(x)./x)
>> plot(abs(x),abs(y))

------------------------------------------------------------------------------
>>syms x y z
>>result = solve('x^(y^z)=exp(z)','z')

result =

-1/log(y)*lambertw(-log(y)*log(x))

>>clear all
>> [x,y] = meshgrid(2:0.1:10);
>> z=-1./log(y).*lambertw(-log(y).*log(x));
>> surf(x,y,z)
>> colormap hsv
>>colorbar

No comments:

Post a Comment