This solution is outdated. To rescore this solution, sign in.
-
5 Comments
Undefined function 'minus' for input arguments of type 'matlab.graphics.chart.primitive.Line'.
Error in Test1 (line 5)
assert(abs(m - (-0.781239288889930)) <= 1e-4)
i cant understand this error the code just works fine on matlab
function m = plot_cos(y, t)
[val,i]=min(y);
m=plot(t,y,'b--',t(i),val,'r*');
end
function m = plot_cos(y, t)
[val,i]=min(y);
m=plot(t,y,'b--',t(i),val,'r*');
end
this code works fine on pc but just got error on test
Undefined function 'minus' for input arguments of type 'matlab.graphics.chart.primitive.Line'.
Error in Test1 (line 5)
assert(abs(m - (-0.781239288889930)) );
end
Hi Ali, this is because the output m is expected to contain the minimum value of the input y, not a handle to the plot.
Hope that helps.
function m = plot_cos(y, t)
[m,idx]=min(y);
t_m=t(idx);
plot(t,y,'b--',t_m,m,'r*')
end
:-D
I have the same problem lol, and thanks for pointing out the blind spot!
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!