Undefined function or variable f when using solve function

4 ビュー (過去 30 日間)
jeremy meyer
jeremy meyer 2016 年 12 月 1 日
編集済み: Stephen23 2016 年 12 月 1 日
solve(RA(12)==1/f*((2/(k+1))*(1+(k-1)/2*f^2))^((k+1)/(2*k-2)),f)
"Undefined function or variable 'f'."
I want matlab to solve for when the correct positive f value makes the equation true. Currently I get a message that reads, Undefined function or variable 'f'. All I can think is duh, that's what I want you to solve for!!! Can someone else tell me why matlab doesn't understand the command and how to fix it? Also, there will be a positive and negative root. Any suggestions on how to tell matlab to just give me the positive root? Thanks!
  1 件のコメント
Stephen23
Stephen23 2016 年 12 月 1 日
編集済み: Stephen23 2016 年 12 月 1 日
@jeremy meyer: did you read the solve documentation? It clearly shows how to specify a variable as being symbolic, which is all you need to do.

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

回答 (2 件)

John D'Errico
John D'Errico 2016 年 12 月 1 日
Did you ever tell MATLAB in advance that f is a symbolic variable?
help syms

Walter Roberson
Walter Roberson 2016 年 12 月 1 日
Before that you need to
syms f
You can further restrict that as
syms f positive
but you should still cross-check the result as sometimes constraints get ignored.

カテゴリ

Help Center および File ExchangeUtilities for the Solver についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by