Task 1 Plotting a Sine Graph % Sine curve close all clear clc fs=20; %Sampling frequency in hz. Sampling time is 1/fs f=1; %frequency of sine wave is 30 hz phi=-pi/4; % initial phase w=2*pi*f; %Omega(angular velocity) a=2; %amplitude t=0:1/fs:2*pi; y=a*sin(w*t+phi); figure; plot(t,y); figure; stem(t,y); //Another way % Sine curve close all clear clc fs=1;

# Category: CSE 432

Digital Signal Processing Lab

## CSE 432 Spring 2019 Lab 2

Task 1 String input output. Adding a variable in an array. %Task 1 clear; clc; var={}; n=input(‘Number of inputs: ‘); for i=1:n x=input(‘Enter String: ‘, ‘s’); var=[var x]; end for i=1:n fprintf(‘%s\n’, var{i}); end Task 2 Create a Matlab Script to find the cgpa of n subjects, where n will be taken as input. All

## CSE 432 Spring 2019 Lab 1

Task 1 Installation of MATLAB Task 2 Basic matlab instructions a=4; b=5; c=a+b; %difference between usiong a semicolon at the end of an instruction and not disp(c); c=a-b; c=a*b; c=a/b; %Matrix and vector a=[0 1 2] a=[0 1 2; 3 4 5] a=[0 1 2; 3 4 5;6 7 8] b=[1 2 3; 4 5