lab_solution1

lab_solution1 - n = 0:14999; n = n * ((2*pi)/15000); r = 1...

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

View Full Document Right Arrow Icon
ECE 101 Fall 2009 Lab #1 Solutions Problem 1: Code: % Problem 1: load Message1.ascii -ascii ; sound(Message1, 8000); plot(Message1); xlabel( 'time' ); ylabel( 'amplitude' ); title( 'Security clearance level 3 or above is required to access files' ); orient landscape ; print; Problem 2: Code: % Problem 2: load Problem2.mat ; N = size(X,1); n = 1:N; C = 25 * cos (n * pi / 8); M = abs(X); K = imag(X); Y = (M-90) .* (K+(C.')); sound(Y, 8000); plot(Y); xlabel( 'time' ); ylabel( 'amplitude' ); title( 'Remember the force will be with you always' ); orient landscape ; print;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Problem 3: Code: % Problem 3: p3 = ((2 + 5*i)*(3 + 2*i)) / ((1 + 7*i)*(1 - 5*i)); magnitude = abs(p3); phase = angle(p3); polar = [magnitude phase]; Problem 4: Code: % Problem 4: save sol3a ; save sol3b Y M C ; FID = fopen( 'sol3c.ascii' , 'w' ); fprintf(FID, '%f\n' , C.'); fclose(FID); Problem 5: Code: % Problem 5:
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n = 0:14999; n = n * ((2*pi)/15000); r = 1 - cos(n); real_z = r .* cos(n); plot(n, real_z); title( 'Problem 5 - Real Part' ); orient landscape ; print; imag_z = r .* sin(n); plot(n, imag_z); title( 'Problem 5 - Imaginary Part' ); orient landscape ; print; Problem 6: The vector x = [1 2 . .. 6 7 6 . .. 2 1] remains unchanged on doing half and twice successively. This is only true for x and not true for an arbitrary vector. Code: half.m function [output] = half(x) n = length(x); if (rem(n,2) == 0) z = (2 * (0 : floor(n/2)-1)) + 1; else z = (2 * (0 : floor(n/2))) + 1; end output = x(z); twice.m function [output] = twice(x) n = length(x); y = (x(1:n-1) + x(2:n))/2; z = zeros(1,((2*n)-1)); odd = (2 * (0 : n-1)) + 1; even = (2 * (1 : n-1)); z(odd) = x; z(even) = y; output = z; Plots Problem 1: Problem 2: Problem 4:...
View Full Document

This document was uploaded on 05/26/2010.

Page1 / 4

lab_solution1 - n = 0:14999; n = n * ((2*pi)/15000); r = 1...

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

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