0% found this document useful (0 votes)
15 views7 pages

Group 01

Uploaded by

Mab Abdul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

Group 01

Uploaded by

Mab Abdul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

QUESTIONS;

QUESTION 4: FUNCTION MANIPULATION

4A

disp("Evaluate the value of expression")

Evaluate the value of expression

disp("y=e^-x sin(y)+10√z")

y=e^-x sin(y)+10√z

disp("where x=5, y=y=π/4, z=8")

where x=5, y=y=π/4, z=8

x=5;, y=pi/4;, z=8;


y= exp(-x) *sin(y) + 10*sqrt(z)

y = 28.2890

4B
disp("To evaluate the following expression:")

To evaluate the following expression:

disp("sin^2(a) + cos^2(a), where a=30⁰")

sin^2(a) + cos^2(a), where a=30⁰

a=30;
answer= sind(a)^2 + cosd(a)^2

answer = 1.0000

4C
disp("To evaluate the expression:")

To evaluate the expression:

disp("sin^-1(0.5)+cos^-1(0.5)")

sin^-1(0.5)+cos^-1(0.5)

asind(0.5)+ acosd(0.5)

ans = 90.0000

4D

1
EVALUATE THE ROOTS OF THE FOLLOWING POLYNOMIALS

4D(i)
disp("y=x^2-5x+6")

y=x^2-5x+6

y=[1,-5,6]

y = 1×3
1 -5 6

ans=roots(y)

ans = 2×1
3.0000
2.0000

4D(ii)
disp("y=x^3-2x^2-3x+10")

y=x^3-2x^2-3x+10

y=[1,-2,-3,10]

y = 1×4
1 -2 -3 10

ans=roots(y)

ans = 3×1 complex


-2.0000 + 0.0000i
2.0000 + 1.0000i
2.0000 - 1.0000i

QUESTION 7: BASIC PLOTTING

7A
disp("Two sets data x=[1 2 3 4 5 6] and y=[3 -1 2 4 5 1]")

Two sets data x=[1 2 3 4 5 6] and y=[3 -1 2 4 5 1]

disp("plot the graph of y verses x")

plot the graph of y verses x

x=[1 2 3 4 5 6]

x = 1×6
1 2 3 4 5 6

2
y=[3 -1 2 4 5 1]

y = 1×6
3 -1 2 4 5 1

plot(x,y,'m_--')

7B
disp("plot the graph of y=sin(x)")

plot the graph of y=sin(x)

disp("for the interval 0≤x≤4π")

for the interval 0≤x≤4π

x=[0:0.5/pi:4*pi]

x = 1×79
0 0.1592 0.3183 0.4775 0.6366 0.7958 0.9549 1.1141

y=sin(x)

y = 1×79
0 0.1585 0.3130 0.4595 0.5945 0.7144 0.8163 0.8975

plot(x,y,'r_-')

3
7C
disp("plot the graph of y=sin(x)")

plot the graph of y=sin(x)

disp("for the interval 0≤x≤4π")

for the interval 0≤x≤4π

x=[0:0.5/pi:4*pi]

x = 1×79
0 0.1592 0.3183 0.4775 0.6366 0.7958 0.9549 1.1141

y=sin(x)

y = 1×79
0 0.1585 0.3130 0.4595 0.5945 0.7144 0.8163 0.8975

plot(x,y,'r_-')
xlabel('0≤x≤4π')
ylabel('y=sin(x)')
title('GRAPH OF SINE FUNCTION')

4
7D
disp("Plot the functions y1=2cos(x),y2=cos(x),y3=0.5cos(x)")

Plot the functions y1=2cos(x),y2=cos(x),y3=0.5cos(x)

x=[0:0.5/pi:4*pi]

x = 1×79
0 0.1592 0.3183 0.4775 0.6366 0.7958 0.9549 1.1141

y1=2*cos(x)

y1 = 1×79
2.0000 1.9747 1.8995 1.7763 1.6082 1.3995 1.1553 0.8820

y2=cos(x)

y2 = 1×79
1.0000 0.9874 0.9498 0.8882 0.8041 0.6997 0.5777 0.4410

y3=0.5*cos(x)

y3 = 1×79
0.5000 0.4937 0.4749 0.4441 0.4021 0.3499 0.2888 0.2205

plot(x,y1,'K',x,y2,'r',x,y3,'b')

5
7E
disp("(sub plot) for different graphs in the same figure ")

(sub plot) for different graphs in the same figure

disp("y1=sin(x),y2=cos(x)")

y1=sin(x),y2=cos(x)

subplot(2,2,1);
y1=sin(x)

y1 = 1×79
0 0.1585 0.3130 0.4595 0.5945 0.7144 0.8163 0.8975

plot(x,y1,'k')
subplot(2,2,4);
y2=cos(x)

y2 = 1×79
1.0000 0.9874 0.9498 0.8882 0.8041 0.6997 0.5777 0.4410

plot(x,y2,'b')

6
7

You might also like