
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Matlab code snippets for generating various signals, including a ramp signal, exponential sequence, sinc function, sine wave, and cosine wave. Each program takes user inputs for the length of the sequence, scaling factor, and time index, and generates the corresponding signal using matlab functions.
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!
clc;close all;clear all; n=input('Enter the length of ramp sequence N = '); % Get the length s=input(' Enter the slop of the ramp S = '); % Get the slop of the ramp t=0:n-1; plot(t,s*t); ylabel ('Amplitude'); xlabel ('Time Index'); TITLE ('Ramp signal'); grid on
clc;close all;clear all;
n=input('Enter the duration of the signal N = '); a=input ('Enter the scaling factor a = '); t=0:.1:n-1; y=exp(a*t); subplot(2,1,1) plot(t,y); ylabel ('Amplitude'); xlabel ('Time Index'); TITLE ('Exponential Signal'); grid on x = linspace(-5,5); y = sinc(x); subplot(2,1,2); plot(x,y); xlabel('time'); ylabel('amplitude'); title('sinc function'); grid on
clc;close all;clear all; t=0:.0001:1; y=5sin(2pi1t); subplot(2,1,1); plot(t,y); ylabel ('Amplitude'); xlabel ('Time Index'); TITLE ('Sine wave'); grid on; t=0:.0001:1; y=5cos(2pi1t); subplot(2,1,2); plot(t,y); ylabel ('Amplitude'); xlabel ('Time Index'); TITLE ('cosine wave'); grid on