REC05+Problems+Set+Solutions - Introduction to Computers...

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

View Full Document Right Arrow Icon
Introduction to Computers for Engineers Recitation 5 - Problems for students to attempt ( Recitation 4 - was the exam) Please complete these problems on your own time if you do not Fnish in recitation. You don ʼ t need to show us the completed recitation problems, although we recommend saving a copy of your solutions for your own beneFt. As you saw in the past few exam days, some of these problems make excellent exam questions. 1. The following weight and height data are collected in two arrays. Plot them in an X-Y plot. The line should be in RED. Add axis labels. Weight=[120 120 140 180 200 250 90] Height = [170 169 175 182 180 180 162] Weight=[120 120 140 180 200 250 90] Height = [170 169 175 182 180 180 162] plot(Weight, Height, 'r'); xlabel('weight'); ylabel('height'); 2. Use linspace to generate 100 points from 0 to 2*pi for x, plot the following functions in a) separate Fgures, b)the same graph, and c) next to each other using subplot 1) y = sin(x) 2) y = cos(x) + sin(x) 3) y = sin(x)cos(x) Title the graph and label the axes a) x = linspace(0,2*pi,100); Fgure(1); plot(x,sin(x)); title('Frst'); xlabel('x'); ylabel('y') Fgure(2); plot(x,cos(x)+sin(x)); title('second'); xlabel('x'); ylabel('y') Fgure(3);plot(x, sin(x) .* cos(x)); title('third'); xlabel('x'); ylabel('y') b) x = linspace(0,2*pi,100); plot(x, sin(x), x, cos(x)+sin(x), x, sin(x) .* cos(x)) title('three in one'); xlabel('x') ylabel('y') c) x = linspace(0,2*pi,100); subplot(1,3,1); plot(x,sin(x)); title('Frst'); xlabel('x'); ylabel('y') subplot(1,3,2); plot(x,cos(x)+sin(x)); title('second'); xlabel('x'); ylabel('y') subplot(1,3,3);plot(x, sin(x) .* cos(x)); title('third'); xlabel('x'); ylabel('y') 3. A rational function is formed by dividing one polynomial by another. The graphs of rational functions can take a
Background image of page 1

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

View Full DocumentRight Arrow Icon
variety of different forms and can be difFcult to plot by hand. But with Matlab it ʼ s a piece of cake J. Plot f(x) = (x+2) / (x^2+1) . fplot('(x+2)./(x.^2+1)',[-10 10])
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/24/2011 for the course PHYSICS 123 taught by Professor Madey during the Spring '08 term at Rutgers.

Page1 / 5

REC05+Problems+Set+Solutions - Introduction to Computers...

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