fixed points in the plots

10 views (last 30 days)
hasan s
hasan s on 11 Apr 2021
Commented: hasan s on 18 Apr 2021
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

Accepted Answer

Walter Roberson
Walter Roberson on 11 Apr 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 Comments
Walter Roberson
Walter Roberson on 17 Apr 2021
There are also datatips(), but datatips() automatically move to the closest data point, which I did not think you would want to do.
hasan s
hasan s on 18 Apr 2021
Thanks prof. Walter for this valuable information ... Yes, right now, I just need to hold the points

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!