Share:
Notifications
Clear all

[Solved] MTH643 Assignment 2 Spring 2021


admin
(@admin)
Admin
Joined: 3 years ago
Posts: 6603
Topic starter  

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

  1. 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
  2. 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

  1. 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


Quote
admin
(@admin)
Admin
Joined: 3 years ago
Posts: 6603
Topic starter  

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:

Share: