Question

In: Computer Science

In a single Matlab script, plot a sine wave and cosine wave over 2 periods (0...

  1. In a single Matlab script, plot a sine wave and cosine wave over 2 periods (0 to 4π). Checkpoints of the requirements:
    1. Generate your independent variables first; the step size should be no larger than 0.1 so that it has enough samples to get smooth lines. Plot the two waves on the same graph.  
    2. Specify the line color and styles: red dashed line for sine & blue solid line with dot markers for cosine.
    3. Include axis labels and a descriptive title (for example: sin and cos graph).

d. Include a legend

e. Set the x limits from 0 to 4??

answer for e.

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc
clear all
close all
format long
x=0:0.1:4*pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,'--r',x,y2,'-.b');
legend('Sine','Cosine');
xlabel('X-axis');
ylabel('Y-values');
xlim([0,4*pi]);

Kindly revert for any queries

Thanks.


Related Solutions

MATLAB Question Write a script to plot the function 'x times sine-squared of x' over a...
MATLAB Question Write a script to plot the function 'x times sine-squared of x' over a user-specified interval. It should prompt the user to enter the starting and stopping values of x, perform the calculation, and plot the result. Test the script using start/stop values 28 and 42.
Create a script that calculates the sine, cosine, and tangent of a vector from 0 to2?...
Create a script that calculates the sine, cosine, and tangent of a vector from 0 to2? with steps of ?/16. The numbers should have three digits to the right of the decimal. Determine an appropriate field width. Use fprintf to display the output in tabular format with the following headers. x sin(x) cos(x) tan(x) Also, plot the three equations in the same figure window, but on separate axes. Plot all thee equations from 0 to 2? on the x-axis. Plot...
Find the Fourier cosine and sine series of f(t) = t^2 ,0 < t < π
Find the Fourier cosine and sine series of f(t) = t^2 ,0 < t < π
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the...
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the following waves: a. ?1 (?) = sin ?? b. ?2 (?) = cos ?? c. ?2 (?) = 0.5 cos ?? d. ?3 (?) = cos (?? − ?) ? = 1 ???/s
In MATLAB; 3- Plot a 8V-2KHZ Sine signal in MATLAB. While this signal varies between C...
In MATLAB; 3- Plot a 8V-2KHZ Sine signal in MATLAB. While this signal varies between C = 10uF-100uF in 1uF steps for your application to the serialRLC circuit, calculate the L values ​​for R = 50 Ohm (constant) that can pass the maximum current through the circuit and write to the file. Plot the change graph of the L value calculated according to each C value.
a MATLAB script that: • Prompts the user for - a lower-bound for the plot interval...
a MATLAB script that: • Prompts the user for - a lower-bound for the plot interval and stores it in a variable named Lbound - an upper-bound for the plot interval and stores it in a variable named Ubound, and - the number of points at which a function is to be evaluated to generate a plot of the function over the specified range and stores it in a variable named npoints. • Generates a plot of f(x) = x3...
Write Matlab code (with detailed comments) to perform spectral analysis of 1KHz sine wave, noise and...
Write Matlab code (with detailed comments) to perform spectral analysis of 1KHz sine wave, noise and noise corrupted sine wave. Consider the sampling frequency Fs=10KHz.                                                                                                                                                   What should be the ideal frequency response of filter required to remove noise? Justify your answer                                                                                                                           
Use MATLAB to plot the functions u = 2 log10(60x + 1) and υ = 3 cos(6x) over the interval 0 ≤ x ≤ 2.
Use MATLAB to plot the functions u = 2 log10(60x + 1) and υ = 3 cos(6x) over the interval 0 ≤ x ≤ 2. Properly label the plot and each curve. The variables u and represent speed in miles per hour; the variable x represents distance in miles.
Plot all four curves over 0 < t < 4 together using MATLAB. Post code in...
Plot all four curves over 0 < t < 4 together using MATLAB. Post code in the response. C1 : x=−5+2e−tcos20t y=−5+2e−tsin20t z=4t C2 : x=−5+2e−tcos20t y=5+2e−tsin20t z=4t C3 : x=5+2e−tcos20t y=−5+2e−tsin20t z=4t C4 : x=5+2e−tcos20t y=5+2e−tsin20t z=4t
Design a complete single-stage amplifier using transistor to amplifier a sine-wave voltage signal with an amplitude...
Design a complete single-stage amplifier using transistor to amplifier a sine-wave voltage signal with an amplitude of 2 mV, frequency range from 20-20kHz and internal resistance of 1k ohm. the output of the amplifier supplies to a load of 5k ohm and the required voltage amplitude around 300 mV.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT