几道有关matlab的题目,不要怪我懒,我是学机电的,cad,solidworks……学了很多没想到选修还要用matlab!

时间不多了,还有几天就要交作业了大家帮帮忙下星期一就要交
2024-12-05 05:51:23
推荐回答(1个)
回答1:

clear
i=1;
sum=0;
while i<=200
sum=sum+i;
i=i+1;
end
sum

clear
x=-1:0.01:1;
y=-1:0.01:1;
[x,y]=meshgrid(x,y);
z=0.54*exp(-0.75*x.^2-3.75*y.^2-1.5*y).*(x+y>宽薯1)+0.7575*exp(-x.^2-6*y.^2).*(x+y<=1).*(x+y>拆链-1)+0.5457*exp(-0.75*x.^2-3.75*y.^2+1.5*y).*(x+y<=-1);
figure(1)
surf(x,y,z)
shading flat

clear
x=0:0.01:20*pi;
y0=cos(100*x);
ys=cos(x);
y=y0+ys;
figure(2)
subplot(3,1,1)
plot(x,y)
subplot(3,1,2)
stem(abs(fft(y))/慎御者length(y)*2)
N=15;
Wn=0.2;
B=FIR1(N,Wn);
yy=filter(B,1,x);
subplot(3,1,3)
plot(x,yy)