Question

Write a Matlab program to plot the cosine wave. That is plot y=cos(k1x) vs. x for x varying from 0 to 2pi radians. The value of k1 is given at the end of this document. You can choose the increment for x. Note that large values of the increment will give you a coarse graph. Note: Matlab has two functions to calculate the sine of an angle: sin(x) and sind(x). What is the difference between these two functions? Use help or doc command to find the answer.

k1=3.84

r1=0.57

r2=2.83

r3=3.8

v0=27.04

theta=40.41

I1=108.44

Answer #1

**Matlab code to plot cosine wave**:

plot y Vs x

k1=3.84;

r1=0.57;

r2=2.83;

r3=3.8;

v0=27.04;

theta=40.41;

l1=108.44;

y = cos(k1*x)

x=[0,pi/2,pi,3*pi/2,pi]

plot(y,x,'r')

xlabel('x');

ylabel('y')

legend( 'cosine(k1*x) Vs x', 'location','Northwest')

The above code is given based on the information provided in the question

**The difference
between the functions sin(x) and sind(x):**

Both are used to find the argument of the sine function for the given values but sin(x) is used when the arguments are in "RADIANS", whereas sind(x) is used when the arguments are given in DEGREES".

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 3 minutes ago

asked 5 minutes ago

asked 6 minutes ago

asked 8 minutes ago

asked 11 minutes ago

asked 16 minutes ago

asked 16 minutes ago

asked 16 minutes ago

asked 18 minutes ago

asked 18 minutes ago

asked 18 minutes ago

asked 20 minutes ago