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/07/18 18:30:54
![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](/uploads/image/z/7634262-30-2.jpg?t=matlab+%E5%BC%80%E6%96%B9%E8%BF%90%E7%AE%97+%E7%94%BB%E5%9B%BEclc%3Bx%3D0%3A0.1%3A15%3By%3Dsqrt%28x%2Ax-4%2Ax%2B20%29%2Bsqrt%28x%2Ax%2B9%29%3Bfigureplot%28x%2Cy%29%3B%E6%8A%A5%E9%94%99%E4%B8%BAError+using+%3D%3D%3E+mtimesInner+matrix+dimensions+must+agree.Error+in+%3D%3D%3E+suanshu+at+3y%3Dsqrt%28x%2Ax-4%2Ax%2B20%29%2Bsqrt%28x%2Ax%2B9%29%3Bfigure)
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);