CSE 432 Fall 2019 Lab 3

October 11, 2019

Task 1 Plotting a sine curve close all clear clc freq=input(‘Freqiuency of Sine function= ‘); amp=input(‘Amplitude of Function= ‘); phi=input(‘Initial Phase of Sine Function= ‘); time=input(‘End Time for Signal= ‘); fs=freq*10; %Following nyquist critereon t=0:1/fs:time; w=2*pi*freq; y=amp*sin(w*t+phi); figure(1) plot(t,y) figure(2) stem(t,y) Task 2 Plotting a cosine curve close all clear clc freq=input(‘Freqiuency of Cosine function=

Continue Reading

CSE 432 Fall 2019 Lab 2

September 26, 2019

Task 1 Introduction to for loop %Use of for loop close all clear clc n=input(‘Number of inputs= ‘); if (n>0) for i=1:n r=input(‘radius= ‘); area=pi*r*r; circ=2*pi*r; fprintf(‘Radius= %g\tArea= %g\tCircumference= %g\n’, r, area, circ) end else fprintf(‘ERR:Number must be Positive\n’); end %Task for students %Change the code such that if the radius is negative, it will

Continue Reading