How to plot a surface in an easy way

1 visualizzazione (ultimi 30 giorni)
Daniel
Daniel il 7 Lug 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?

Risposte (1)

the cyclist
the cyclist il 7 Lug 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!

Translated by