Ho to enter this equation and plot it
Afficher commentaires plus anciens
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
Réponses (2)
TastyPastry
le 5 Nov 2015
0 votes
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 commentaire
mohamed mohamed
le 5 Nov 2015
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 commentaires
mohamed mohamed
le 5 Nov 2015
Walter Roberson
le 5 Nov 2015
If it gave you the warning about rank deficient then you used / instead of ./
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!