Ho to enter this equation and plot it

1 回表示 (過去 30 日間)
mohamed mohamed
mohamed mohamed 2015 年 11 月 5 日
コメント済み: Walter Roberson 2015 年 11 月 5 日
X=10:50;
w=.2:1.2;
y=(230-(x*.2))/(.5+w);
every time it show
error using / .
Matrix dimensions must agree
finally i need to plot the answer in 2d x&y

回答 (2 件)

TastyPastry
TastyPastry 2015 年 11 月 5 日
Well you can't do either right matrix or element by element division on the vectors X and w. X is 1x41 while w is 1x2. I'm assuming you need to do element by element division, which is ./, but even then, that wouldn't work since your vectors aren't the same size.
  1 件のコメント
mohamed mohamed
mohamed mohamed 2015 年 11 月 5 日
I want to divide(230-(x*.2))/(.5+w) so that w will take different number from (.2:1.2) the value of w will reach 1.2 at x=30 then w remains constant and only x will change so that i can perform element by element division

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


Thorsten
Thorsten 2015 年 11 月 5 日
編集済み: Thorsten 2015 年 11 月 5 日
I'm not sure what you want, but if you want to evaluate y for every combination of x and w on a 2D grid, you can use:
x=10:50; w=0:0.2:1.2;
[X, W] = meshgrid(x,w);
y=(230-(X*.2))./(.5+W);
surfl(y)
Note that I used a differed w with more than just 2 values such that you can use surfl.
  2 件のコメント
mohamed mohamed
mohamed mohamed 2015 年 11 月 5 日
It gave me warning: rank defecient and after completing the program it gave me 3d graph and when i tried touse plot command to give me 2d dimension it gave me the same previous error however i need wto vary from .2:1.2 it reach 1.2 at x=30 after that w remain constant
Walter Roberson
Walter Roberson 2015 年 11 月 5 日
If it gave you the warning about rank deficient then you used / instead of ./

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

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by