Plotting Error (Very Simple Code)
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
onsagerian
il 3 Feb 2018
Modificato: onsagerian
il 3 Feb 2018
As part of practice of plotting, I made a very simple code, but it has an error. Would you check the code and explain on the problem so that I can make an correction?
x=1.0:0.2:2.0; y=2/x; plot(x,y)
Error using / Matrix dimensions must agree.
Error in Untitled6 (line 2) y=2/x;
0 Commenti
Risposta accettata
Walter Roberson
il 3 Feb 2018
y = 2./x;
The operation A/B is like A * inv(B) where * is algebraic matrix multiplication. You want element-by-element division, which is the ./ operator
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!