Question: Write a MATLAB script check02 that prompts for user input of a vector Yin and displays on the screen two vectors Yplus and Yminus
Write a MATLAB script check02 that prompts for user input of a vector Yin and displays on the screen two vectors Yplus and Yminus such that Yplus and Yminus contain the positive and negative values entered in Yin, respectively. In case one of these two output vectors does not have any element (that is empty), it will show an empty matrix. Test your code with: (a) [18, -5, 89, -7, 4, 10, 12, 34, -2, 45]; (b) [34, 67, 89, 0, 12, 87, 0, 5]; Note: initialize vectors Yplus and Yminus as 0-by-0 empty matrices using: >> Yplus = []; Yminus = [ ]
Step by Step Solution
3.42 Rating (155 Votes )
There are 3 Steps involved in it
Here is a MATLAB script named check02 that fulfills the requirement of separating positive and ... View full answer
Get step-by-step solutions from verified subject matter experts
