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.
我正在尝试根据范围绘制函数结果;为此,我定义了范围 -
r = [-1:0.01:4.5]
我有一个G.m描述函数的文件 -
G.m
function [y] = G(x) y=(1/4)*((x^3)-4*(x^2)+7*x); end
我想检查G所有范围内的功能r。
G
r
我试过plot(r,G(r))没有成功。
plot(r,G(r))
改变
y=(1/4)*((x^3)-4*(x^2)+7*x);
至:
y=(1/4)*((x.^3)-4*(x.^2)+7*x);
并且plot(r,G(r))会为你工作,我的朋友。