matlab 开方运算 画图clc;x=0:0.1:15;y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figureplot(x,y);报错为Error using ==> mtimesInner matrix dimensions must agree.Error in ==> suanshu at 3y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figure

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 17:00:18
matlab 开方运算 画图clc;x=0:0.1:15;y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figureplot(x,y);报错为Error using ==> mtimesInner matrix dimensions must agree.Error in ==> suanshu at 3y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figure

matlab 开方运算 画图clc;x=0:0.1:15;y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figureplot(x,y);报错为Error using ==> mtimesInner matrix dimensions must agree.Error in ==> suanshu at 3y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figure
matlab 开方运算 画图
clc;
x=0:0.1:15;
y=sqrt(x*x-4*x+20)+sqrt(x*x+9);
figure
plot(x,y);
报错为
Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> suanshu at 3
y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figure

matlab 开方运算 画图clc;x=0:0.1:15;y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figureplot(x,y);报错为Error using ==> mtimesInner matrix dimensions must agree.Error in ==> suanshu at 3y=sqrt(x*x-4*x+20)+sqrt(x*x+9);figure
你是什么意思啊?你如果是最终想得到y(i) = sqrt(x(i)*x(i)-4*x(i)+20)+sqrt(x(i)*x(i)+9),就把中间的*改成.*,前面有个".",这表示对应项相乘
如果是求x的模,则要用x'*x,这样得到的就是x的模长
估计你想要的形式是第一个.
clc;
x=0:0.1:15;
y=sqrt(x.*x-4.*x+20)+sqrt(x.*x+9);
figure
plot(x,y);