Question: ( a ) Sketch a flowchart ( Visio diagram ) for Matlab code that repeatedly prompts a user to enter ( 5 marks ) a
a Sketch a flowchart Visio diagram for Matlab code that repeatedly prompts a user to enter
marks
a prime number until the user enters a prime number. Use a while loop and an if statement.
b Write a Matlab code snippet for the problem outlined in a above. Your code should output appropriate messages when the number entered is and is not, a prime number. Hint: Use a while loop and Matlab's input disp fprintf and
marks
isprime functions.
c Consider the arrays below containing the names of elements and their corresponding atomic weights:
elementHydrogen "Helium" "Lithium";
aweight ;
Using Matlab's fprintf function, write code that uses a for loop to print out the following:
The atomic weight of Hydrogen is amu
The atomic weight of Helium is amu
The atomic weight of Lithium is amu
marks
d Write a piece of code that uses a nested for loop and an if statement to display the array elements whose value is less than
marks
e Write down the command to delete row from the matrix below:
marks
f Write a piece of code to plot pressure, against temperature, and volume, against temperature, on the same graph.
marks
g Write a user defined function in MATLAB that takes two square matrices of equal size and multiplies them elementwise. Show:
The code for the user defined function
How to call the user defined function from another script filc
marks
Use matlab please.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
