How to plot a surface in an easy way

1 view (last 30 days)
Daniel
Daniel on 7 Jul 2013
Hi guys! I have a function LSQDiff which takes a vector argument x that consists of two values x(1) and x(2) and returns a vector of differences.
I want to take a squared norm of this vector and plot it for different values of x(1) and different values x(2)
I have vector a for different values of x(1) and vector b for x(2);
How can I plot a surface with this?

Answers (1)

the cyclist
the cyclist on 7 Jul 2013
Here is a simple example of using the surf() command to plot a surface.
a = 1:10;
b = 1:7;
[aa,bb] = meshgrid(a,b);
z = aa + bb.^2;
surf(aa,bb,z)

Community Treasure Hunt

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

Start Hunting!