0% found this document useful (0 votes)
11 views3 pages

Ex 7

The document contains MATLAB code that generates two plots: one for the sine function and another for the cosine function based on a range of values from -30 to 30. It calculates the values of sine and cosine for the squared values of the input range divided by 12, and then plots these functions. The output includes the computed values of n, y (sine), and z (cosine).

Uploaded by

Me Erra
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)
11 views3 pages

Ex 7

The document contains MATLAB code that generates two plots: one for the sine function and another for the cosine function based on a range of values from -30 to 30. It calculates the values of sine and cosine for the squared values of the input range divided by 12, and then plots these functions. The output includes the computed values of n, y (sine), and z (cosine).

Uploaded by

Me Erra
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/ 3

%EX_7

n=linspace(-30,30,30)
y=sin(((pi*n)/12).^2)
z=cos(((pi*n)/12).^2)
plot(n,y)
hold on
plot(n,z)

n =

Columns 1 through 7

-30.0000 -27.9310 -25.8621 -23.7931 -21.7241 -19.6552 -17.5862

Columns 8 through 14

-15.5172 -13.4483 -11.3793 -9.3103 -7.2414 -5.1724 -3.1034

Columns 15 through 21

-1.0345 1.0345 3.1034 5.1724 7.2414 9.3103 11.3793

Columns 22 through 28

13.4483 15.5172 17.5862 19.6552 21.7241 23.7931 25.8621

Columns 29 through 30

27.9310 30.0000

y =

Columns 1 through 7

-0.9115 -0.0630 0.9585 0.8919 0.8017 0.9748 0.7130

Columns 8 through 14

-0.7140 -0.1699 0.5225 -0.3354 -0.4371 0.9656 0.6132

Columns 15 through 21

0.0733 0.0733 0.6132 0.9656 -0.4371 -0.3354 0.5225

Columns 22 through 28

-0.1699 -0.7140 0.7130 0.9748 0.8017 0.8919 0.9585

Columns 29 through 30

-0.0630 -0.9115

1
z =

Columns 1 through 7

0.4114 -0.9980 -0.2849 0.4522 0.5977 0.2233 -0.7011

Columns 8 through 14

-0.7002 0.9855 -0.8526 0.9421 -0.8994 -0.2599 0.7899

Columns 15 through 21

0.9973 0.9973 0.7899 -0.2599 -0.8994 0.9421 -0.8526

Columns 22 through 28

0.9855 -0.7002 -0.7011 0.2233 0.5977 0.4522 -0.2849

Columns 29 through 30

-0.9980 0.4114

2
Published with MATLAB® R2013b

You might also like