fixed points in the plots
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a program that includes a graph of functions in 3D
I need to fix points on the drawing (show the location of the points on the drawing),
I used
hold on ;
plot (A(1),B(2.1),G(3.021),'r*')
plot (A(0.0001),B(3),G(3.21),'r*')
plot (A(3.654),B(3.1),G(2.15),'r*')
But an error appeared to me...
Error in POINTS (line 45)
plot (A(1),B(2.1),G(3.021),'r*')
if any Prof. can help me ...thanks alot
0 commentaires
Réponse acceptée
Walter Roberson
le 11 Avr 2021
syms A B G
A, B, and G are created as scalar symbols
f = matlabFunction(sum1m2, 'vars', [A, B, G]);
g = matlabFunction(sum3m4, 'vars', [A, B, G]);
h = matlabFunction(sum5m6, 'vars', [A, B, G]);
f, g, and h are created as numeric functions of three inputs.
plot (A(1),B(2.1),G(3.021),'r*')
plot (A(0.0001),B(3),G(3.21),'r*')
plot (A(3.654),B(3.1),G(2.15),'r*')
You try to index scalar A at 1, which works, giving you back the scalar symbol A .
You try to index scalar B at 2.1, which fails, because you cannot index at non-integers... and if you could do that, you would be indexing past the end of the scalar.
You try to index scalar G at 3.021, which fails, non integer, past the end of the scalar. Is it possible that function g was intended? But function g needs three parameters, not one.
I suspect what you want is
plot ((1),(2.1),(3.021),'r*')
plot ((0.0001),(3),(3.21),'r*')
plot ((3.654),(3.1),(2.15),'r*')
10 commentaires
Walter Roberson
le 17 Avr 2021
There are also datatips(), but datatips() automatically move to the closest data point, which I did not think you would want to do.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!