MATLAB Coding | matlabcoding.com
10.3K subscribers
138 photos
31 files
908 links
Everything Free. BOOKS, MATLAB PROGRAMS, CODES and Study Materials. Also Questions and Answers. For older/archived post visit matlabcoding.com
Books - https://amzn.to/3PnfYnN

Reach us - info.matlabcoding@gmail.com
Download Telegram
matlab-basic-functions-reference.pdf
672.5 KB
MATLAB® Basic Functions Reference
Forwarded from Python Coding
clear all
Fs = 1000; % sampling frequency
dt =1/Fs; % time increment
tfinal = 1 ; % time of measurement 1sec
time=0:dt:tfinal;
% My signal sum of 60Hz and 120Hz sin wave
y=sin(2*pi*120*time)+0.5*sin(2*pi*60*time);
L =length(time); % length of signal
SRC=zeros(1,L);
f=1/dt; % Maximum frequency
NFREQ = 1000;
FREQ = linspace(0,f,NFREQ);
% % INITIALIZE FOURIER TRANSFORMS
K = exp(-1i*2*pi*dt*FREQ);
for T = 1 : L
for nf = 1 : NFREQ
SRC(nf) = SRC(nf) + (K(nf)^T)*y(T);
end
end
% % FINISH FOURIER TRANSFORMS
SRC = SRC*dt;
plot(FREQ,abs(SRC(1:NFREQ)))
MATLAB Coding | matlabcoding.com pinned «join here with 27k people https://www.facebook.com/groups/MATLABCODES/»