How to plot a surface in an easy way

1 次查看(过去 30 天)
Daniel
Daniel 2013-7-7
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?

回答(1 个)

the cyclist
the cyclist 2013-7-7
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)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by