Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a MATLAB script to convert from cartesian to polar coordinates. Ask the user to enter the real (x) and the imaginary (y) components

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1. Write a MATLAB script to convert from cartesian to polar coordinates. Ask the user to enter the real (x) and the imaginary (y) components of Z from keyboard (Z = 1 - j). The static phasor in problems 2-5 will be the user created one in this problem (5 points) Hint: Sample code for part of this problem is provided in Practice #1. 2. Following Problem 1, write MATLAB Code that calculates the magnitude and phase of the input static phasor, by using the mathematical equations shown in class. (5 points) Hint: Use Practice #1 as example, mathematically the magnitude would be sqrt[(1)+(-1)?]=sqrt(2)=1.4142, and the phase or angle would be arctan(-1/1)=-0.7854 3. Using MATLAB Plot subroutine polarplot to plot in the polar plane: (5 points) Hint: Sample code for part of this problem is provided in Practice #2. 4. Using MATLAB Plot in cartesian coordinates (10 points) 1 Hint: Sample code for part of this problem is provided in Practice #3. 5. Using the hold on commend to add plots in the figure. What are the polar coordinates of Z+X and Z+Y if X=2+3j and Y=2-3j? and plot each on the cartesian and polar plots: (5 points) REMEMBER: when adding signals it is easier to add in cartesian coordinates where you add the real and add the imaginary components so T = Z + X = (1 - i) + (2+3j) = 1+2 -j+3j = 3+2j 6. Now let's say you have a signal = 1.41 *exp(j*(-0.784)). In MATLAB create signal = 1.41 * expli*(-0.784)). What are the real and imaginary parts using MatLab and the Euler's formula? Put your answers after % right after the codes (10 points) 7. In MATLAB, calculate the real and imaginary parts of the following signals, and plot them on the polar plot. Now you are going from polr to cartesian (10 points) a) XX = 0.5e(2) YY = 3el(+1/2) ZZ = 1.5eil/5) b) c) Example: Z = 2el-in) and e j = cos 0 + j sin e, so the real part of Z will be 2*cos(-1)=-2, and the imaginary part will be 2*sin(-A) =-2.4493e-16 ~O. So in MATLAB write 2*exp(-1*pi) it will return -2.0000 - 0.00001 8. For the following static phasors, calculate Z, write MATLAB code for your answer in cartesian and polar coordinates and create a figure in MATLAB of X, Y and Z similar to the plot below. (10 points) Hint: Plot([0,X]) to form a line. Imaginary Real Ex X = 3.61 Z-0.98rad Y = 4.47 Z-2.68rad Z = X+Y #1: Write a MATLAB script to convert from cartesian to polar coordinates for Z = 1-j Z=1-i abs (Z) angle (Z) Ans = 1.4142 for magnitude and ans = -0.7854 for phase, so it would be 1.4142e-:(0.7854) in polar coordinates #2: Using MATLAB Plot subroutine polarplot to plot the static phasor, 1.4142e/(0.7854) in #1, in the polar plane. 90 120 60 polarplot(-.7854,1.41,'*') 2 150 30 180 0 210 330 240 300 270 #3: Using MATLAB Plot the Z = 1-j in cartesian coordinates plot(z,'r*') axis([-11-11]) grid on #4: Example for plotting a cos signal and calculating phase shift of half pi. 0.8 0.6 0.4 0.2 0 time=0:0.0001:0.0025 f = 400 signal = cos(2*pi*f*time); plot(time, signal, 'b'); % default is blue color signalplushalfpi = cos(2*pi*f*time+pi/2); hold on; sis minushalfpi = cos(2* pi*f*time-pi/2); plot(time, signalplushalfpi, 'r') % this will plot signal in red plot(time, signalminushalfpi, 'g') % this will plot signal in green xlabel('Time sec') ylabel('Amplitude") 5.0.2 -0.4 -0.6 -0.8 0.5 1 2 1.5 Time sec 100 1. Write a MATLAB script to convert from cartesian to polar coordinates. Ask the user to enter the real (x) and the imaginary (y) components of Z from keyboard (Z = 1 - j). The static phasor in problems 2-5 will be the user created one in this problem (5 points) Hint: Sample code for part of this problem is provided in Practice #1. 2. Following Problem 1, write MATLAB Code that calculates the magnitude and phase of the input static phasor, by using the mathematical equations shown in class. (5 points) Hint: Use Practice #1 as example, mathematically the magnitude would be sqrt[(1)+(-1)?]=sqrt(2)=1.4142, and the phase or angle would be arctan(-1/1)=-0.7854 3. Using MATLAB Plot subroutine polarplot to plot in the polar plane: (5 points) Hint: Sample code for part of this problem is provided in Practice #2. 4. Using MATLAB Plot in cartesian coordinates (10 points) 1 Hint: Sample code for part of this problem is provided in Practice #3. 5. Using the hold on commend to add plots in the figure. What are the polar coordinates of Z+X and Z+Y if X=2+3j and Y=2-3j? and plot each on the cartesian and polar plots: (5 points) REMEMBER: when adding signals it is easier to add in cartesian coordinates where you add the real and add the imaginary components so T = Z + X = (1 - i) + (2+3j) = 1+2 -j+3j = 3+2j 6. Now let's say you have a signal = 1.41 *exp(j*(-0.784)). In MATLAB create signal = 1.41 * expli*(-0.784)). What are the real and imaginary parts using MatLab and the Euler's formula? Put your answers after % right after the codes (10 points) 7. In MATLAB, calculate the real and imaginary parts of the following signals, and plot them on the polar plot. Now you are going from polr to cartesian (10 points) a) XX = 0.5e(2) YY = 3el(+1/2) ZZ = 1.5eil/5) b) c) Example: Z = 2el-in) and e j = cos 0 + j sin e, so the real part of Z will be 2*cos(-1)=-2, and the imaginary part will be 2*sin(-A) =-2.4493e-16 ~O. So in MATLAB write 2*exp(-1*pi) it will return -2.0000 - 0.00001 8. For the following static phasors, calculate Z, write MATLAB code for your answer in cartesian and polar coordinates and create a figure in MATLAB of X, Y and Z similar to the plot below. (10 points) Hint: Plot([0,X]) to form a line. Imaginary Real Ex X = 3.61 Z-0.98rad Y = 4.47 Z-2.68rad Z = X+Y #1: Write a MATLAB script to convert from cartesian to polar coordinates for Z = 1-j Z=1-i abs (Z) angle (Z) Ans = 1.4142 for magnitude and ans = -0.7854 for phase, so it would be 1.4142e-:(0.7854) in polar coordinates #2: Using MATLAB Plot subroutine polarplot to plot the static phasor, 1.4142e/(0.7854) in #1, in the polar plane. 90 120 60 polarplot(-.7854,1.41,'*') 2 150 30 180 0 210 330 240 300 270 #3: Using MATLAB Plot the Z = 1-j in cartesian coordinates plot(z,'r*') axis([-11-11]) grid on #4: Example for plotting a cos signal and calculating phase shift of half pi. 0.8 0.6 0.4 0.2 0 time=0:0.0001:0.0025 f = 400 signal = cos(2*pi*f*time); plot(time, signal, 'b'); % default is blue color signalplushalfpi = cos(2*pi*f*time+pi/2); hold on; sis minushalfpi = cos(2* pi*f*time-pi/2); plot(time, signalplushalfpi, 'r') % this will plot signal in red plot(time, signalminushalfpi, 'g') % this will plot signal in green xlabel('Time sec') ylabel('Amplitude") 5.0.2 -0.4 -0.6 -0.8 0.5 1 2 1.5 Time sec 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago