matlab为什我的这个程序不对?function [x,y] = adder(x1,y1,x2,y2)x=min(min(x1),min(x2)):max(max(x1),max(x2));l=length(x);y11=zeros(1,l);y22=y11;y11(find(x>=min(x1))&(x=min(x2))&(x=min(x1))&(x=min(x1))&(x=min(x2))&(x> step=0.01;>> x1=-2*pi:step
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/31 03:06:07
matlab为什我的这个程序不对?function [x,y] = adder(x1,y1,x2,y2)x=min(min(x1),min(x2)):max(max(x1),max(x2));l=length(x);y11=zeros(1,l);y22=y11;y11(find(x>=min(x1))&(x=min(x2))&(x=min(x1))&(x=min(x1))&(x=min(x2))&(x> step=0.01;>> x1=-2*pi:step
matlab为什我的这个程序不对?
function [x,y] = adder(x1,y1,x2,y2)
x=min(min(x1),min(x2)):max(max(x1),max(x2));
l=length(x);
y11=zeros(1,l);
y22=y11;
y11(find(x>=min(x1))&(x=min(x2))&(x=min(x1))&(x=min(x1))&(x=min(x2))&(x> step=0.01;
>> x1=-2*pi:step:0;
>> x2=0:step:2*pi;
>> y1=sin(x1);
>> y2=cos(x2);
>>[x,y] = adder(x1,y1,x2,y2,step);
matlab为什我的这个程序不对?function [x,y] = adder(x1,y1,x2,y2)x=min(min(x1),min(x2)):max(max(x1),max(x2));l=length(x);y11=zeros(1,l);y22=y11;y11(find(x>=min(x1))&(x=min(x2))&(x=min(x1))&(x=min(x1))&(x=min(x2))&(x> step=0.01;>> x1=-2*pi:step
你的这2句确实有问题,主要不知道你的y1和y2是什么样子的,感觉应该是标量数值吧
如果y1、y2也是向量的话,你通过前面的find语句找出的序号不一定和y1一样长度吧
因为不知道x1,y1,x2,y2的具体情况,只能将y1和y2当做标量处理,对你有一定的参考作用
如果有问题,再探讨:
function [x,y] = adder(x1,y1,x2,y2)
x=min(min(x1),min(x2)):max(max(x1),max(x2));
L=length(x);
y11=zeros(1,L);
y22=y11;
y11(find(x>=min(x1)&x=min(x2)&x