Beginner Matlab Question for Physics Lab Plot

5 vues (au cours des 30 derniers jours)
Nathan Green
Nathan Green le 22 Oct 2018
Hello, I'm currently working on a task that requires the use of Matlab, which I am a complete newbie at - I've never even opened the program until today. Additionally, I have no computer science background at all. I cannot emphasize enough that I have no idea what I am supposed to be doing here. I need to learn how to do this type of stuff, so I would super appreciate any instruction at all on how to accomplish what is being asked in the problem below using the Matlab program.
For some background, this is the first part of the problem, which I think I may have somewhat successfully blundered through:
(a) For the particular lowpass filter you constructed in lab (f3dB ~ 11kHz) plot H(f) over the frequency range (0, 100 kHz) on a semilogarithmic scale for the frequency, and use a linear scale in dB for the vertical axis. To calculate H(f) simply solve for the output voltage in terms of the input voltage—it should be a simple voltage divider using the impedances of the capacitor and resistor. You will need to define an appropriate vector of frequencies.
I can’t figure out how to set the Y-axis to a linear scale however, so if anyone knows how to do that some guidance would be greatly appreciated.
Here are the parts that I am currently trying to work through:
(b) For a 200 Hz square wave with unit amplitude, plot the approximation to it found by summing the first four terms of the Fourier series (that is, to the 7th harmonic) over the first period of the square wave [0, 5ms].
(c) To see how a filter can distort a signal, repeat part (b) but plot the resultant signal after it has gone through the lowpass filter of part (a). To do this you will need to use H(f) to determine V out for each harmonic input (1,3,5,7), then sum those to get the result.
Thank you in advance for literally any help that can be given as I am quite stuck. I apologize for my complete lack of experience with Matlab and for basically needing someone to hold my hand through the process.
  1 commentaire
Kevin Chng
Kevin Chng le 22 Oct 2018
Hi Nathan,
highly recommend you to learn MATLAB from this free MATLAB online course :
MATLAB Onramp

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 22 Oct 2018
The scales on all axes in the MATLAB plotting functions is linear.
See the documentation on the plot (link) function for a complete discussion.
I strongly encourage you to read the section on Getting Started (link). Another useful resource is Debug a MATLAB Program (link).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by