MATLAB中plot函数用法MATLAB中输入>> x=1:0.1:3f=sin(x)*(1+x)*log(1+x);plot(x,f)运行出错?Error using ==> mtimesInner matrix dimensions must agree.如果改成>> x=1:0.1:3f=sin(x).*(1+x).*log(1+x);plot(x,f)运行正确,可以绘出图形来.

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 06:01:51
MATLAB中plot函数用法MATLAB中输入>> x=1:0.1:3f=sin(x)*(1+x)*log(1+x);plot(x,f)运行出错?Error using ==> mtimesInner matrix dimensions must agree.如果改成>> x=1:0.1:3f=sin(x).*(1+x).*log(1+x);plot(x,f)运行正确,可以绘出图形来.

MATLAB中plot函数用法MATLAB中输入>> x=1:0.1:3f=sin(x)*(1+x)*log(1+x);plot(x,f)运行出错?Error using ==> mtimesInner matrix dimensions must agree.如果改成>> x=1:0.1:3f=sin(x).*(1+x).*log(1+x);plot(x,f)运行正确,可以绘出图形来.
MATLAB中plot函数用法
MATLAB中输入
>> x=1:0.1:3
f=sin(x)*(1+x)*log(1+x);
plot(x,f)
运行出错?Error using ==> mtimes
Inner matrix dimensions must agree.
如果改成
>> x=1:0.1:3
f=sin(x).*(1+x).*log(1+x);
plot(x,f)
运行正确,可以绘出图形来.想知道sin(x)、(1+x)后面为什么必须加一个“.”才能运行?这个“.”代表什么,具体怎么用,什么地方加,什么地方不加?我是初学者.

MATLAB中plot函数用法MATLAB中输入>> x=1:0.1:3f=sin(x)*(1+x)*log(1+x);plot(x,f)运行出错?Error using ==> mtimesInner matrix dimensions must agree.如果改成>> x=1:0.1:3f=sin(x).*(1+x).*log(1+x);plot(x,f)运行正确,可以绘出图形来.
f=sin(x).*(1+x).*log(1+x) 中的x是矩阵 所以 sin(x)也是矩阵(你可以看看sin(x)的大小就知道了)
要加.才能实现矩阵对应的元素相乘 如果不加是两个矩阵相乘