I am trying to get this contour plot to work. This is a simple example so I can figure out how to do it before applying it to trickier equations.
I have this function saved in a separate .m file:
function a = triarea(x,y)a = x.^3-2.*x-5+y.^2;end
The main script calls this function:
for s=[0:1:3], for t=[0:1:3], q=triarea(s,t) endend
This displays the range of values for q (one after the other, ideally I'd like them as one matrix upon completion but don't know how to do that).
What I want to do is a contour plot where the x-axis is the s variable and the y-axis is the t variable and q is represented as the contour i.e. varying in colour depending on it's value at each s,t point.
How do I do this?
It says that the contour variable Z must be at least a 2×2 matrix but I have only one value at each s,t point.
Best Answer