What does this code mean?
显示 更早的评论
clc
t=linspace(-1,1,256);%%%
F=1; %%% kare dalga frekansı
A=2; %%% kare dalga genliği
harmonik=3;
kare=zeros(1,length(t));
for k=1:harmonik
coeff=(2*A)/(k*pi)*sin(k*pi/2);
kare=coeff*cos(k*2*pi*F*t)+kare;
end k_d=A/2+kare;
figure(1)
plot(t,kare);
grid on
close all
time=20;
Ts=1/100; %%% örnekleme frekansı
t=0:Ts:(time-Ts);
x=2*[t <= 2]; %%%% kare dalga genliği ve zaman aralığı
N=length(x);
ssf=((-N/2):(N/2-1))/(Ts*N);
fx=Ts*fft(x(1:N));
fxs=fftshift(fx);
figure
subplot(2,1,1);
set(plot(t,x),'LineWidth',1.5);
xlabel('sn');
subplot(2,1,2);
set(plot(ssf,abs(fxs)),'LineWidth',1.5);
xlabel('Frekans [Hz]'); ylabel('Genlik')
What does this code do? I need only variables like fx, ssf etc. What are these for?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
