-
-
Save GiovanniBalestrieri/93feee1b637103e5b7e8 to your computer and use it in GitHub Desktop.
snippet - Basic Matlab Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Signal definition | |
% Sampling Frequency Fs | |
Fs = 350; | |
% Sinusoid frequency | |
freq = 30; | |
bias = 15 | |
t = 0:1/Fs:1; | |
% Generate random values [min,max] = [xm,xM] | |
xm=0.2; | |
xM=2; | |
amp = xm+ (xM-xm).*rand(1,1); | |
% Use random value for the amplitude | |
y = amp*sin(2*pi*freq*t) + bias; | |
y0 = 0; | |
y18 = 18; | |
% Plots raw data vs samples | |
figure(1); | |
plot(t,y); | |
hold on | |
plot(t,y0,'r','LineWidth',2); | |
hold on | |
plot(t,y18,'k'); | |
title('Sinusoid'); | |
xlabel('Time [s]'); | |
ylabel('Amplitude of f'); | |
grid on | |
grid minor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment