由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Mathematics版 - matlab plot question -- surf
相关主题
如何用matlab计算下面特殊的二重积分 (转载)Help On functional derivative
Re: 复线性空间上的实functional问个Matlab里面关于把scaler function转换为vector function
[转载] Help on a mathematics problem!请教用matlab求偏导的现成function
我问关于matlab 画图matlab handle 一问 (转载)
Re: sigmaplot问题(zt)不等式一题
matlab画图的问题请教curl运算符在1维和2维空间怎么定义?
要画动画是不是可以用 tecplot ?Does anyone know Grassmann ring?
a small question大家能不能推荐解ODE的入门书?
相关话题的讨论汇总
话题: surf话题: myfun话题: so话题: meshgrid话题: function
进入Mathematics版参与讨论
1 (共1页)
r*******y
发帖数: 1081
1
Here is an example of surf:
[x,y] = meshgrid(-2:0.1:2,-2:0.1:2);
surf(x,y,)
But Now I want to apply surf to my defined function myFun(x,y)
But I can not say surf(x,y,myFun(x.,y.))
So any suggestion? Thanks.
k**x
发帖数: 2611
2
I think the output of your defined function should be in matrix form.
r*******y
发帖数: 1081
3
But it is not the way I want. I just define a scalar function of two
variables.
So no way to apply surf to this kind of defined funciton? Thanks.

【在 k**x 的大作中提到】
: I think the output of your defined function should be in matrix form.
Q***5
发帖数: 994
4
koox is right, you have to prepare a matrix first.
If your `f' function can only take two variables, you can do the following
to come up with that matrix:
[x,y] = meshgrid(-2:0.1:2,-2:0.1:2);
x1 = x(:);
y1 = y(:);
for k = 1:length(x1)
z1(k,1) = f(x1(k), y1(k));
end
z = reshape(z1, size(x));
surf(x,y,z)

【在 r*******y 的大作中提到】
: But it is not the way I want. I just define a scalar function of two
: variables.
: So no way to apply surf to this kind of defined funciton? Thanks.

r*******y
发帖数: 1081
5
thanks a lot. I learned something from your code.

【在 Q***5 的大作中提到】
: koox is right, you have to prepare a matrix first.
: If your `f' function can only take two variables, you can do the following
: to come up with that matrix:
: [x,y] = meshgrid(-2:0.1:2,-2:0.1:2);
: x1 = x(:);
: y1 = y(:);
: for k = 1:length(x1)
: z1(k,1) = f(x1(k), y1(k));
: end
: z = reshape(z1, size(x));

1 (共1页)
进入Mathematics版参与讨论
相关主题
大家能不能推荐解ODE的入门书?Re: sigmaplot问题(zt)
问gradient based methodsmatlab画图的问题
问一个矩阵不等式的问题. 在线等要画动画是不是可以用 tecplot ?
请问quotient space的基本概念a small question
如何用matlab计算下面特殊的二重积分 (转载)Help On functional derivative
Re: 复线性空间上的实functional问个Matlab里面关于把scaler function转换为vector function
[转载] Help on a mathematics problem!请教用matlab求偏导的现成function
我问关于matlab 画图matlab handle 一问 (转载)
相关话题的讨论汇总
话题: surf话题: myfun话题: so话题: meshgrid话题: function