⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examp34.m

📁 ADSP TOOLBOX: Version 2.0 and gui m-files
💻 M
字号:

clc,echo on 
%EXAMPLE 34 
n=1:5;                             % Index to compute X[k] 
j=sqrt(-1);xk=j./(n*pi);           % FS coefficients
k=[-fliplr(n) 0 n];                % Harmonic index 
Xk=[conj(fliplr(xk)) 1 xk];        % FS coefficients for two-sided spectrum
dtplot(k,abs(Xk),'o'),pause(2)     % Plot magnitude spectrum
dtplot(k,angle(Xk),'o'),pause(2)   % Plot phase in radians
T=0.2;t=0:0.001:T;                 % Time period and time array for 1 period 
xp=0;
echo off                           % Initialize reconstruction  
for m=1:length(k);                 % Loop for reconstruction
xp=xp+Xk(m)*exp(j*2*pi*k(m)*t/T);  % Add harmonics
end                                % End of loop. Prompt reappears
echo on
%for m=1:length(k);                % Loop for reconstruction
%xp=xp+Xk(m)*exp(j*2*pi*k(m)*t/T); % Add harmonics
%end                               % End of loop. Prompt reappears
xp=real(xp);                       % Force real result
plot(t,xp)                         % Plot reconstruction 
echo off %end of example

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -