Total beginner needs some help solving an equation

Hi all, I'm a complete beginner with Matlab, I decided to start learning a bit about it recently as I would like to use Matlab to write a code for some calculations I am doing.
I don't need you guys to send me codes or anything, just some hints to point me in the right direction would be very much appreciated!
So here's a link to the equation that I want to solve ---> http://dl.dropbox.com/u/23857814/Equation.JPG
Just to clarify the equation, 'Cn' and 'lamda' are in fact known values, or let's say they are variables that i can give specific values to so that in the equation only 'K' is unknown.
So my question is, how do I go about to solve for K in Matlab? Like I said, just some tips would be great :)
Thanks in advance.
Erik

 採用された回答

G A
G A 2012 年 2 月 24 日

1 投票

doc solve

3 件のコメント

Erik
Erik 2012 年 2 月 24 日
Hey GA
Thanks a bunch, I tried this 'solve' function, by re-writing the equation in the OP and Matlab seems to return me an answer, and it looks something like this ...
=====================================================================
>> solve ('(pi^4/(4*K))*((1+0.9973*K/pi)/(pi*K/0.9973)^2)*(0.5*pi*K/0.9973*(((1+0.9973*K/pi)/(1-pi*K/0.9973))+(1-pi*K/0.9973))+log(1-pi*K/0.9973))= 0.0689')
ans =
-3.097648011376843898931207281328
=====================================================================
However, I have a follow up question. Like I said in my OP, 'Cn' and 'lamda' are variables that I will be changing regularly, and in the above case, Cn=0.0689 and lamda=0.9973, so to prevent from manually adjusting the equation every time I want to change 'Cn' and 'lamda', I would like to write a simple code that looks something like this ...
=====================================================================
clear
format long
Cn = input('Please entre desired value of power coefficient: ');
while Cn <= 0
Cn = input('Power coefficient cannot be negative or zero, please entre an appropriate value: ');
end
lamda = input('Please entre desired value of advance ratio: ');
while lamda <= 0
Cn = input('Advance ratio cannot be negative or zero, please entre an appropriate value: ');
end
solve ('(pi^4/(4*k))*((1+lamda*k/pi)/(pi*k/lamda)^2)*(0.5*pi*k/lamda*(((1+lamda*k/pi)/(1-pi*k/lamda))+(1-pi*k/lamda))+log(1-pi*k/lamda))= Cn')
=====================================================================
This results in an error that looks like this ...
Warning: Explicit solution could not be found.
> In solve at 160
In calc at 15
ans =
[ empty sym ]
I still don't know Matlab well enough to understand what the error is suggesting and frankly I have no idea how to resolve this, any tips?
Thanks again, very much appreciated!
Erik
Sean de Wolski
Sean de Wolski 2012 年 2 月 24 日
uses the SUBS function to substiture values into symbolic variables:
doc subs
G A
G A 2012 年 2 月 24 日
Erik, you can try this way:
lamda=0.9; Cn=0.06;
syms k
solve (eval('(pi^4/(4*k))*((1+lamda*k/pi)/(pi*k/lamda)^2)* (0.5*pi*k/lamda*(((1+lamda*k/pi)/(1-pi*k/lamda))+(1-pi*k/lamda))+log(1-pi*k/lamda))-Cn'),k)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

質問済み:

2012 年 2 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by