Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % dkrypt dwa_sin.m
- % generacja 2 sygnalow, sumowanie sygnalow
- clear all; clf
- Tk=2; % czas trwania sygnalu [s]
- fs=1000; % czestotliwosc probkowania [Hz]
- f1=2; f2=100; % czestotliwosci sinusoid [Hz]
- A1=1; A2=1; % amplitudy sinusoid
- % ++++++++++++++++++++++++++++++++++++++++++++++++
- dt=1/fs; % okres probkowania [s]
- t=0:dt:Tk-dt; % wektor czasu
- s1=A1*sin(2*pi*f1*t); % sygnal 1.
- s2=A2*sin(2*pi*f2*t); % sygnal 2. (sinusoida)
- L=length(s2); % dlugosc sygnalu 2.
- Lps=L/Tk; % Liczba probek w czasie 1 s
- syg2=[ones(Lps) zeros(Lps)];
- suma=s1+syg2; % suma sygnalow s1 i s2
- % ++++++++++++++++++++++++++++++++++++++++++++++++
- subplot(2,2,1)
- plot(t,s1); grid on
- xlabel('Czas [s]')
- ylabel('[V]')
- title('Sygnal 1. (sinusoidalny)')
- subplot(2,2,2)
- plot(t,syg2, 'b'); grid on
- xlabel('Czas [s]')
- ylabel('[V]')
- title('Sygnal 2. (prostokatny bipolarny)')
- subplot(2,2,3)
- plot(t,suma, 'g'); grid on
- xlabel('Czas [s]')
- ylabel('[V]')
- title('Suma 1. i 2.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement