Error using matlab.internal.graph.MLGraph.edgesConstrWithIndex Source must be a numeric array of positive integer node indices.
Show older comments
Hi,
I am trying to make a simple plot but none of my attempts seems to work. On a main file i use this code
y2=0;
x=-10:0.001:4;
y1=((x+1).^3).*(x-2);
graph(x,y1,y2);
and on file graph.m i use this code
function graph(x,y1,y2)
figure
plot(x,y1,'r-',x,y2,'b-*','MarkerSize',2)
xlabel ( 'x','FontName','Arial','FontSize',10);
ylabel ( 'y','FontName','Arial','FontSize',10);
title( 'Plot y1, y2','FontSize',10 );
When i change the x as following: x=1:0.001:4; another error occurs "Target must be a numeric array of positive integer node indices."
I also get these errors
Error in matlab.internal.graph.constructFromEdgeList (line 220)
[G, ind] = matlab.internal.graph.MLGraph.edgesConstrWithIndex(s, t, totalNodes);
Error in graph (line 300)
matlab.internal.graph.constructFromEdgeList(...
Error in bisection3 (line 30)
graph(x,y1,y2);
If this has to do with x,y1,y2 being consisted by only positive integers, that does not make sense to me, since plots should also be consisted of negative coordinances if necessary. I am new in matlab so excuse me if this a simple question. I tried to apply other solutions but they din not work
Thank you in advance
Accepted Answer
More Answers (0)
Categories
Find more on Title 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!