Question

HW 5 Sprmg 2017 N Due Date: May 05, 2017 Points: 15 [1] Arrays J [2 3 4 1 5 6] and K [3 2 1 4 5 2], create a 3x2 subplot where each subplot plots J versus K using bar, loglog, semilogx, semilogy. plot and scatter. Title and label each plot appropriately. Use a grid, but a legend is not necessary. [5] [2] Create an animation of a red circle following a blue sine and cosine waveforms. Use x-axis between 0 to 16 pi with 2000 equally spaced numbers. Create a menu, which displays options: Sine, Cosine, and Exit. [5] 13 Create a Matlab script to record a movie of the I just need you to answer of question.2, thanks 15] 10

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 2:

Answer: Matlab: %get the number of circles rotationsv- input (Enter NUMBER of rotations of unit circles: %checks the emptyline ([X1 (it) X1 (it)], [0 Y1 (it)]) line ([0 X1 (it)], [0 Yl (it) ]) line ([X1 (it) X1 (it)1, [Y1 (it) -2, Color, r linExecutable code:

%get the number of circles
rotationsV = input('Enter NUMBER of rotations of unit circles: ');
%checks the empty
if isempty(rotationsV)
rotationsV = 1;
end
%calls the linspace()
thetaS = linspace(0,rotationsV*2*pi,250);
r1 = 1;
X1 = cos(thetaS);
Y1 = sin(thetaS);
%call uimenu()
ff = uimenu('Label','Menu');
uimenu(ff,'Label','Sine','Callback','disp(''Sine'')');
uimenu(ff,'Label','Cosine','Callback','disp(''Cosine'')');
uimenu(ff,'Label','Exit','Callback','disp(''exit'')');
display(ff);
hold on;
%for loop
for it = 1:numel(thetaS)
pause(0.1);
cla
%plot subplot
subplot(2,2,1)
%axis equals
axis equal
hold on;
%defines cylinder()
[a1,b1] = cylinder(r1,100);
plot(a1(1,:),b1(1,:));
axis([-2 2 -2 2])
%line defines
line([0 X1(it)],[0 0]);
line([X1(it) X1(it)],[0 Y1(it)]);
line([0 X1(it)],[0 Y1(it)]);
line([X1(it) X1(it)],[Y1(it) -2],'Color','r');
line([X1(it) 2],[Y1(it) Y1(it)],'Color','r');
% Plots the red circle
plot(X1(it),Y1(it),'o','MarkerEdgeColor','r',...
'MarkerFaceColor','r',...
'MarkerSize',5)
%plots subplot
subplot(2,2,2)
ezplot( @(thetaS) sin(thetaS),[0 thetaS(it+1)]);
axis([0 rotationsV*2*pi -2 2])
line([0 thetaS(it)],[sin(thetaS(it)) sin(thetaS(it))],'Color','r');
%plots subplot
subplot(2,2,3)
ezplot( @(thetaS) cos(thetaS),[0 thetaS(it+1)]);
axis([0 rotationsV*2*pi -2 2])
line([0 thetaS(it)],[cos(thetaS(it)) cos(thetaS(it))],'Color','r');
%plots subplot
subplot(2,2,4)
%plot the theta
plot(thetaS,sin(thetaS),thetaS,cos(thetaS),'Color','b');
axis([0 rotationsV*2*pi -2 2])
line([0 thetaS(it)],[sin(thetaS(it)) sin(thetaS(it))],'Color','r');
%calls the line
line([0 thetaS(it)],[cos(thetaS(it)) cos(thetaS(it))],'Color','r');
end

Add a comment
Know the answer?
Add Answer to:
Arrays J = [2 3 4 1 5 6] and K = [3 2 1 4...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This uses MATLAB code with plotting HW19: Plotting with plot () Due 11:59 pm Monday 1....

    This uses MATLAB code with plotting HW19: Plotting with plot () Due 11:59 pm Monday 1. (10 pts) Write a script that will produce a sine curve and a cosine curve in the same plot, 0 as shown to the right. 06 0.4 0.2 To have two sets of data in one plot, you may plot the first one, then with the command hold on", plot the other. Or, you can learn how to plot two lines with just one...

  • PROBLEM 4 Suppose that a system is shown in Figure 4. There are three controllers that might be incorporated into this system. 1. Ge (s)-K (proportional (P) controller) 2. GS)K/s (integral (I) contro...

    PROBLEM 4 Suppose that a system is shown in Figure 4. There are three controllers that might be incorporated into this system. 1. Ge (s)-K (proportional (P) controller) 2. GS)K/s (integral (I) controller) 3. G (s)K(1+1/s) (proportional, integral (PI) controller) The system requirements are T, < 10 seconds and P0 10% for a unit step response. (a) For the (P) controller, write a piece of MATLAB code to plot root locus for 0<K<,and find the K value so that the...

  • 1. Suppose x(t) -3u(t+3) - u(t)+ 3H(t-3) - 5H(t-6) a. Sketch x(t). b. For the signal x(t) given, ...

    I need a Matlab code example plz 1. Suppose x(t) -3u(t+3) - u(t)+ 3H(t-3) - 5H(t-6) a. Sketch x(t). b. For the signal x(t) given, determine and sketch the following signals: ,g(t) x(t-6) g2(t) - x(3t-6) ii. s(t) x(3t-6) +2 c. Create a MATLAB script that uses a function to express x(t), and plots x(t) in the time interval- 5 < t < 8s, using a time increment of At= 0.01s. Next, use the function to graph each of the...

  • 1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 {...

    1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 { 4 j = 1; 5 while (j < 4) 6 { 7 if (i % 2 == j % 2) 8 k = 100*i + 10*j; 9 else 10 k = 100*j + 10*i; 11 j++; 12 } 13 } What will be the value of the variable k at the end of the third, sixth, ninth, and twelfth iteration of the while loop

  • b- Consider a unity feed- back control system has (S+1 +)(S+2) (S+1-j) 3 4S2 6S +...

    b- Consider a unity feed- back control system has (S+1 +)(S+2) (S+1-j) 3 4S2 6S + 4 a-Prove that as K-8 the gain margin-7.96 db at 2.45 rad/sec. and the phase margin 44.1 degrees at 1.56 rad/sec.? b-Sketch the polar plot? c-Sketch the Bode plot? d- Sketch the Nichols plot and Show Gm and Ym on the plots? e-Write short MATLAB program to solve a, b, c and d?

  • Only #6. The two equations are listed above. For solutions 1-3 use log(acetone) and 4-6 use...

    Only #6. The two equations are listed above. For solutions 1-3 use log(acetone) and 4-6 use log(HCl). Also equation 20 is located above. Please show your work. The acetone was 4M and the HCl was 1M. **Please omit the written equation for log[acetone] on the worksheet and use the one in the graph. Thank you! Not sure what data is unclear? If you actually read #6 you don't even need the graphs. Just the slopes that I have given. Need...

  • Find K r" = kt r = 1 t = 0 r = 2 t =3...

    Find K r" = kt r = 1 t = 0 r = 2 t =3 Imagine that you are an engineer working in à mahufaclug created a machine that is used to adhere one part to another. Figure 2 shows Part A being adhered to Part B. You will assume that you have constrained the manipulator such that 0 for all time. Additionally, you will control the acceleration of the end-point of the manipulator, and this expression is given...

  • Arial v 10 BBv CV A. L29 H J K 1 2 3 4 5 6...

    Arial v 10 BBv CV A. L29 H J K 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 fx А B С D E F G I Goodfellow's Flower Shoppe purchased a new delivery van on January 1st. The van cost $45,000 and is expected to have a useful life of 100,000 miles, with a salvage value of $5,000 after that time. Calculate the depreciation for each of the next five years, assuming...

  • 1) Consider a (MM3) GDikjoo) queucing system with k -4, an arrival rate 2 3, and a service rate μ...

    1) Consider a (MM3) GDikjoo) queucing system with k -4, an arrival rate 2 3, and a service rate μ = 3/2. a) Nicely draw the rate diagram for this queueing system (similar to Figures 9 and 10, page 1065, in b) Explicitly write the system of differential equations for the birth-death process corresponding to c) Solve the system of differential equations: assume that at time t-0, the system is full; that is, d) Explicitly give the solution (function) for...

  • 1) Consider a (MMI3GDk(oo) queueing system with k-4, an arrival rate 2 -3, and a service rate a) ...

    helpp 1) Consider a (MMI3GDk(oo) queueing system with k-4, an arrival rate 2 -3, and a service rate a) Nicely draw the rate diagram for this queueing system (similar to Figures 9 and 10, page 1065, in b) Explicitly write the system of differential equations for the birth-death process corresponding to μ = 3/2· your textbook). this queueing system (see your class notes). You need to write k+1 differential equations, one for each the states of the system. c) Solve...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT