🎁BACK-TO-SCHOOL DEAL. Subscribe Now to get 40% OFF at only 8.49 USD/month, only valid until Sep 30th, 2024

Question

Question
اجب هذا السؤال على ورقة جانبية Q4:b - You have the period 5x<20 with increment value 0.05, draw multiple plots by using MATLAB codes with the given equations: y = sin x + 5, z = cos * * 30. (Only codes no results needed). (upload file question)

Asked By RadiantSunset32 at

Answered By Expert

Barry

Expert · 1.5k answers · 1k people helped

The code is given below with comments to help you understand it. Please comment if you have any doubts

 

The code:

 x = 5 :0.05: 20;    %defining range according to question
 
 y = sin(x) + 5;
 z = cos(x) * 30;       %the required two functions
    


 plot(x,y)              %ploting xy graph 
 hold on                % hold on the graph in place when we draw the next
 
 plot(x,z)              %ploting xz graph 
 xlabel("x")             %labelling the x axis
 legend("sin x +5", "cos x * 30")   %giving legends to the graph

 

Screenshot of code and output:

x = 5 :0.05: 20;\ndefining range according to question\n30\nsin x +5\nCos x 30\ny = sin(x) + 5;\nz = cos(x) * 30;\n20\nthe required t

 

🧑‍🏫 More Questions