Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need assistance with this Matlab code I have that is used to convert a chirp s

ID: 2318337 • Letter: I

Question

I need assistance with this Matlab code I have that is used to convert a chirp signal into sound. I keep getting the error "Too many output arguments" when trying to plot the soundsc. I receive the same problem when I try to make the spectrogram of the sound.

So basically, how do I plot this?

How do I plot this with spectrogram?

and how to I increase the volume through the code? Not the frequency but the volume thanks

function [xx,tt]=mychirp(f1,f2,dur,fs)
if (nargin<4)%If input arguments are less than 4 then sampling rate is automatically 11025 Hz
fs=11025;
end

tt=0:1/fs:dur; %Creates sampling window
m=(f2-f1)/(2*dur); %Calculating slope
psi=3.1416*2*(m*tt.*tt+100); %pi=3.1416
xx=real(7.7*exp(j*psi));
soundsc(xx,fs);%obtaining sound
end

Used with these parameters (200,1100,3,11025)

Explanation / Answer

Code is executing and I am getting beep sound.

Follow the process:

First open new m file and type the following code:

function [xx,tt]=mychirp(f1,f2,dur,fs)

if (nargin<4)%If input arguments are less than 4 then sampling rate is automatically 11025 Hz

fs=11025;

end

tt=0:1/fs:dur; %Creates sampling window

m=(f2-f1)/(2*dur); %Calculating slope

psi=3.1416*2*(m*tt.*tt+100); %pi=3.1416

xx=real(7.7*exp(j*psi));

soundsc(xx,fs);%obtaining sound

end

Now save the file as mychirp.m

Now type the following code in the command prompt.

>> [xx,tt]=mychirp(200,1100,3,11025);

Get beep sound output.

To increase sound need to increase slope by adjusting as per requirement.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote