r3_yun_solution

# r3_yun_solution - %% Exercise 4 [maximum, column] = max(x')...

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

%% Problem 1 n = 1:50; gamma = 0.5772156649; hn = cumsum(1./n); fn = gamma + log(n); gn = gamma + log(n) + 1./(2*n); hn_fn = abs(hn - fn); hn_gn = abs(hn - gn); figure(1) plot(n,hn,'b',n,fn,'r') figure(2) plot(n,hn,'b',n,gn,'r') figure(3) plot(n,hn_fn,'b',n,hn_gn','r') %% Practice Exercise 3.2 %% Problem 1 x= -2:1:2; abs(x) sqrt(x) %% Problem 2 %a sqrt(-3) sqrt(3) %b % nthroot(-3,2) Does not work because n must be odd if x is negative nthroot(3,2) %c -3^(1/2) 3^(1/2) %% Problem 3 x=-9:3:12 x/2 rem(x,2) %% Problem 4 exp(x) %% Problem 5 %a log(x) %b log10(x) %% Problem 6 sign(x) %% Problem 7 format rat x/2 format short % returns the format to the default

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

View Full Document
% Practice Exercises 3.4 %% Exercise 1 theta = 3*pi; sin(2*theta) %% Exercise 2 theta = 0:0.2*pi:2*pi; cos(theta) %% Exercise 3 asin(1) %% Exercise 4 x = -1:0.2:1; acos(x) %% Exercise 5 % a cos(45*pi/180) cosd(45) %% Exercise 6 asin(0.5) %% Exercise 7 cscd(60) % Practice Exercises 3.5 x = [4 90 85 75; 2 55 65 75; 3 78 82 79; 1 84 92 93] %% Exercise 1 max(x) %% Exercise 2 [maximum, row] = max(x) %% Exercise 3 max(x')

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

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

Unformatted text preview: %% Exercise 4 [maximum, column] = max(x') %% Exercise 5 max(max(x)) % or max(x(:)) % Practice Exercises 3.6 x = [4 90 85 75; 2 55 65 75; 3 78 82 79; 1 84 92 93] %% Exercise 1 mean(x) %% Exercise 2 median(x) %% Exercise 3 mean(x') %% Exercise 4 median(x') %% Exercise 5 mode(x) %% Exercise 6 mean(mean(x)) % or mean(x(:)) % Practice Exercises 3.7 x = [4 90 85 75; 2 55 65 75; 3 78 82 79; 1 84 92 93] %% Exercise 1 size(x) %% Exercise 2 sort(x) %% Exercise 3 sort(x, 'descend' ) %% Exercise 4 sortrows(x) %% Exercise 5 sortrows(x,-3) % Practice Exercises 3.9 %% Exercise 1 rand(3) %% Exercise 2 randn(3) %% Exercise 3 x = rand(100,5); %% Exercise 4 max(x) std(x) var(x) mean(x) %% Exercise 5 x = randn(100,5); %% Exercise 6 max(x) std(x) var(x) mean(x) %% Problem 3.21 %a T=randn(1,121)*2+70; t=0:120; %b plot(t,T) %c [maximum, element]=max(T) max_Temp_time=t(element) [minimum, element]=max(T) min_Temp_time=t(element) %%...
View Full Document

## This document was uploaded on 11/04/2011 for the course ENGINEERIN 440 at Rutgers.

### Page1 / 4

r3_yun_solution - %% Exercise 4 [maximum, column] = max(x')...

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

View Full Document
Ask a homework question - tutors are online