0% found this document useful (0 votes)
18 views

Task 2

This document contains code that defines variables x, y1, y2, y3, and y4 using sine functions with different frequencies. It then plots the variables against x in subplots with 2 rows and 2 columns to visualize the sine waves.

Uploaded by

Hannan Ahmed
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Task 2

This document contains code that defines variables x, y1, y2, y3, and y4 using sine functions with different frequencies. It then plots the variables against x in subplots with 2 rows and 2 columns to visualize the sine waves.

Uploaded by

Hannan Ahmed
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

TASK # 2

>> x=-360:60:360
x=
-360 -300 -240 -180 -120 -60

0 60 120 180 240 300 360

>> y1=sin(100*x)
y1 =
Columns 1 through 10
0.4704 0.8027 0.9806 0.9702 0.7732 0.4277

0 -0.4277 -0.7732 -0.9702

Columns 11 through 13
-0.9806 -0.8027 -0.4704
>> y2=sin(200*x)
y2 =
Columns 1 through 10
-0.8303 -0.9575 -0.3840 0.4704 0.9806 0.7732

0 -0.7732 -0.9806 -0.4704

Columns 11 through 13
0.3840 0.9575 0.8303
>> y3=sin(300*x)
y3 =
Columns 1 through 10
0.9949 0.3395 -0.8303 -0.7420 0.4704 0.9702
Columns 11 through 13
0.8303 -0.3395 -0.9949
>> y4=y1+y2+y3
y4 =
Columns 1 through 10

0 -0.9702 -0.4704 0.7420

0.6350 0.1847 -0.2336 0.6985 2.2243 2.1711


Columns 11 through 13
0.2336 -0.1847 -0.6350
>> subplot(2,2,1),plot(x,y1)
>> subplot(2,2,2),ploy(x,y2)
>> subplot(2,2,2),plot(x,y2)
>> subplot(2,2,3),plot(x,y3)
>> subplot(2,2,4),plot(x,y4)

0 -2.1711 -2.2243 -0.6985

You might also like