Using loglog for plotting a logarithmic graph

1 回表示 (過去 30 日間)
Viran Silva
Viran Silva 2014 年 11 月 22 日
コメント済み: Youssef Khmou 2014 年 11 月 22 日
Hello.
Part of my 2 part assignment is to complete a loglog graph plot of a certain function, and it happens to be a complicated function;
96818.90647*sqrt(55327.86446+((19.62x)/25.88677539))*log(1+(x/73000))
And the x values I have to plot the function against the x values is in the range of x=10-19700.
The code I have written so far is:
>> x = 10:19700
>> loglog([x],[96818.90647*sqrt(55327.86446+((19.62x)/25.88677539))*log(1+(x/73000))])
But MatLab keeps giving me the unexpected Matlab expression - is there anything that I am doing wrong with my code so far?
All I am trying to do is plot a graph of these x values against the function, and I am very new to Matlab - so any help is greatly appreciated.
Thank you in advance.
- Viran

採用された回答

Youssef  Khmou
Youssef Khmou 2014 年 11 月 22 日
You have to use element wise operator ( . before any operator sign) :
x = 10:19700;
y=96818.90647.*sqrt(55327.86446+((19.62*x)/25.88677539)).*log(1+(x/73000));
loglog(x,y)
  2 件のコメント
Viran Silva
Viran Silva 2014 年 11 月 22 日
編集済み: Viran Silva 2014 年 11 月 22 日
Okay, why did that work when you added periods to it?
Youssef  Khmou
Youssef Khmou 2014 年 11 月 22 日
no periods are added. operations of vectors/matrices are not performed unless they compatible in size.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by