How to plot a function with an unknown answer and a changing variable?

Say I have an equation with a changing variable, call it R. I want to have the values of R between 0.001 and 0.01.
R is a part of an equation X, and I want to plot the value of X for the changing variables of R. How do I do this?
I tried to use fplot, but it was only giving me a straight line, which I know is not the answer.

2 件のコメント

Walter Roberson
Walter Roberson 2018 年 2 月 8 日
One of the most common reasons for getting an unexpected straight line is if you have used / in a place you need ./ instead .
But beyond that, we would need to see code.
Nicole Cronin
Nicole Cronin 2018 年 2 月 8 日
編集済み: Walter Roberson 2018 年 2 月 8 日
Here's the code I wrote -
fplot(@( R ) X ,[0.001 0.010]
for the equation
X = (1/sqrt( R )) + 2.0*log((m/(3.7*D))+ (2.51/(Re*sqrt( R ))));
m, D, and Re are variables I currently have saved.

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

 採用された回答

Walter Roberson
Walter Roberson 2018 年 2 月 8 日

0 投票

X = @(R) (1/sqrt( R )) + 2.0*log((m/(3.7*D))+ (2.51/(Re*sqrt( R ))));
fplot(X, [0.001 0.010])

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by