# [Solved] MTH643 Assignment 2 Spring 2021

Special Assignment MTH643

Due Date: July 08, 2021 at 06:00 PM

Total Marks 20

Please read the complete question paper carefully before start to solve it.

Write the program in script file of MATLAB. Then copy and paste the code and output of the program on assignment module at VULMS.

**Question:**

Write a MATLAB program

- Which takes the 9 digits number as an input from user (when you run the program for output then this number should be the 9 digits of your student ID, for example if your ID is bc190020340 then the input will be 190020340).
**Marks 03** - Then use the conditional statement to check that if the number is even or odd.
**Marks 05**

- If the number is even then divide the number with 2 and save the resultant in a variable ‘ID’, whereas if the number is odd then save the original 9 digit number in the variable ‘ID’.

**Marks 02**

- Then plot the following functions in the same window on the interval [-10,10]
**Marks 10**

*F *= sin(ID´ *x*)

*G *= cos(ID´ *x*)

## Title of the graph should be your student ID.

If the last digit of your student ID is 0 then color of the plots should be

**Blue and green**

If the last digit of your student ID is 1 then color of the plots should be

**Red and green**

If the last digit of your student ID is 2 then color of the plots should be

**Red and yellow**

If the last digit of your student ID is 3 then color of the plots should be

**Black and green**

If the last digit of your student ID is 4 then color of the plots should be

**Magenta and yellow**

If the last digit of your student ID is 5 then color of the plots should be

**Red and black**

If the last digit of your student ID is 6 then color of the plots should be

**Black and magenta**

If the last digit of your student ID is 7 then color of the plots should be

**Red and magenta**

If the last digit of your student ID is 8 then color of the plots should be

**Yellow and blue**** **

If the last digit of your student ID is 9 then color of the plots should be

**Black and yellow**

Students kindly share assignment files in relevant subject timely for discussion/solution.

or directly share with us " **Click here**"

**QueryVU Telegram Groups subject wise** **Join Now**

**QueryVU WhatsApp groups subject wise** **Join Now**

**MTH643 Assignment 2 Spring 2021**

MTH643 Assignment 2 Spring 2021 Solution idea:

**Program:**

close all clear all clc %syms ID x format long ; % for input value num = input('Enter your 9 digit id: '); % for finding remainder value ansr = rem(num,2); % condition check for even odd and save in ID variable if(ansr == 0) disp('Even'); ID =num/2; else disp('odd'); ID = num; end x= -10:0.8:10; plot(x,sin(ID*x),'k'); hold on plot(x,cos(ID*x),'g'); hold off xlabel('x'); ylabel('y'); title('MC190202659'); grid on;

**Output****:**

Latest Post: CS201 Final Term Important Topic & Papers 2018 to 2021 || cs201 final term preparation topic Our newest member: casinoypkdy92 Recent Posts Unread Posts

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed