且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

matlab 常量匿名函数只返回一个值而不是数组

更新时间:2023-02-19 11:44:05

您正在定义一个函数 f = @(x,y) [0, 1]; ,它具有输入参数 x,y 和输出 [0,1].您还期望发生什么?

You are defining a function f = @(x,y) [0, 1]; which has the input parameters x,y and the output [0,1]. What else do you expect to happen?

更新:

这应该与您的描述相符:

This should match your description:

g=@(x,y)[zeros(size(x)),ones(size(y))]
g(x',y')