MATLAB is a programming language which has extensive libraries that are applicab
ID: 3747561 • Letter: M
Question
MATLAB is a programming language which has extensive libraries that are applicable to electrical engineering. For this project you will call a number of MATLAB libraries from C# to do calculations on sound files. Your C# program will do the following: 1. Allow the user to choose a .wav file. 2. Provide user options to do the following: A) Call a MATLAB function which will return information about the wav file including the following: sample frequency, number of channels (mono or stereo), number of samples, bits per sample, and duration in seconds. B) Call a MATLAB function to play the wavfile. C) Plot the wav file in time and frequency (two plots) using the forms charting tool. (You will need to call a MATLAB function to read the wav file which will provide the time domain data and a second MATLAB function to get the Fourier transform frequency domain data.) D) Allow the user to modify either the time axis or the frequency axis by enter new start and stop values. E) Allow the user to create a filtered version of the wavfile after entering a filter type (low pass or high pass), a cutoff frequency (fs/10 fc 4fs/10), a sample frequency (fs), and a file name for the filtered wav file. The user should be able to repeat step B and play the filtered wav file. The following MATLAB functions on the following page have been written for you. You C# program will call these functions to get the required data. Before you can use the MATLAB function you will need to add a reference to the MATLAB application. Right click on References. Click on Add reference. Under COM locate Matlab Application and select that as a new reference. In your code add the line: MLApp.MLApp matlab = new MLApp.MLApp(); // Change to the directory where the functions are located matlab.Execute(@"cd c:coursesEE3568MLFunction"); Once this is done you can use the functions listed below as shown.
Explanation / Answer
clc;
clear all;
close all;
x5input(‘enter the 1st sequence’);
h5input(‘enter the 2nd sequence’);
y5conv(x,h);
figure;subplot(3,1,1);
stem(x);ylabel(‘Amplitude --.’);
xlabel(‘(a) n --.’);
subplot(3,1,2);
stem(h);ylabel(‘Amplitude --.’);
xlabel(‘(b) n --.’);
subplot(3,1,3);
stem(y);ylabel(‘Amplitude --.’);
xlabel(‘(c) n --.’);
disp(‘The resultant signal is’);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.