ece 100

ece 100 - %Matlab script for ECE100 Lab 1 %here the...

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

View Full Document Right Arrow Icon
%Matlab script for ECE100 Lab 1 %here the resonant frequency w_0 = 1 for convenience. It is just a scaling factor w=0.01:.01:20; %defines a vector of frequency samples, starting at w=0.01 % and ending at w=20, with steps of 0.01 % %note: to operate on a vector term by term you need the . operators %for example to square a scalar a use a^2 but to square each term in %a vector v use v.^2 %to multiply a vector and a scalar use a*v but to multiply two vectors %term by term use v.*y %to invert a vector term by term use 1./v %the ; after a statement suppresses printing of the result %when in doubt about use of a function (like plot) do "help plot" at the command line % figure %create a new figure window and give it a number for z=[0.1 0.3 0.7 1 3 10]; %z is the damping factor h=1./(1 + j*2*z*w -w.^2); %calculates the h(w) complex vector for each z in the list h2=abs(h).^2; %need squared magnitude of complex h(w) vector plot(w,h2) %plot on linear axes xlabel('Frequency \omega/\omega_0') %characters preceded by \ are in TeX
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

ece 100 - %Matlab script for ECE100 Lab 1 %here the...

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

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