20115ee102_1_hw2_matlab_solu

20115ee102_1_hw2_matlab_solu - 1 EE102 Systems and Signals...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 EE102 Systems and Signals Fall Quarter 2011 Jin Hyung Lee Matlab Assignment #1 Solution Getting Started Matlab For this lab we only need the basic abilities of matlab to create and manipulate vectors, and plot the results. The documentation for matlab exists in many places, including the book that comes with student matlab, the online help (the question mark on the user interface), and the Mathworks web site. A document called ”Matlab Getting Started” is also posted on EEWEB for your reference. Preparing Your Lab Report Your lab report will consist of a record of the matlab commands, matlab responses, and the plots you generate. To save a copy of your matlab interaction, type >> diary lab1task1.txt This will save everything you type, and all of matlab responses. To add comments, use a % sign at the beginning of the line. >> % This is a comment If you want to stop recording while you try something out, type >> diary off and then, when you want to start recording again, >> diary on Finally, when you are done, you can edit the diary file in your favorite text editor to add com- ments, or eliminate the text from when you asked for ”help”, or forgot a semicolon, and printed the entire array. For each task below, the diary file should only contain a few lines. For the report, submit the (cleaned up) diary file, and the plots that go with it. Matlab Plotting Basics One of the simplest uses of matlab is as a graphing calculator. We’ll go over a simple plotting example. Suppose we want to make plots of the waveforms w ( t ) = e- t , x ( t ) = te- t and y ( t ) = e- t + te- t from t = 0 to t = 10 . We want to plot them on both separate and common axes. We follow these steps: 1. Create a time vector: >>t=0:.1:10; 2 This creates a vector, with name t , whose elements range from to 10 in intervals of . 1 . You can type t to see the ( 101 ) entries of the vector t . When you finish the line with a semicolon, Matlab won’t print out the results of the operation. You can see what happens if you type >>t=0:.1:10 (no semicolon). 2. Now form a vector whose i th component is w ( t i ) : >>w=exp(-t); This creates a 101-vector w whose elements are the values of w at times specified in the time vector t . Here we are using a nice feature of Matlab syntax: when a function that normally applies to a real or complex number (such as exp ) is applied to a vector, then Matlab applies the function to every entry of the vector....
View Full Document

{[ snackBarMessage ]}

Page1 / 9

20115ee102_1_hw2_matlab_solu - 1 EE102 Systems and Signals...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online