Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据此处的参考示例,我似乎无法将工作区中的变量用作函数表达式中的常量。例如,尝试这样做:
ezplot('theta * (1 x y) - 0.5', 0,8,-5,4);
其中 theta 是一个3 x 1 向量导致错误
3 x 1
theta * [1;x;y] - 0.5 cannot be plotted in the xy-plane.
有没有办法绕过这个限制?
如果theta是1 x 3(不可能3 x 1)那么你可以使用
theta
1 x 3
ezplot(@(x,y) theta * [1;x;y] - 0.5, [0,8,-5,4]);
请注意,将函数定义为字符串时,不能引用工作区中的另一个变量。您需要创建一个匿名函数。绘图范围也不是单独的参数。您需要传递一个长度为 4 的向量。