Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problems 13 and 14 please File Ecit Bonk Windw Help brrBack Fon-ardMake Hihligh Make Nor ment Hichlghes Icomln 2ot com to Fi Hand Tool Stat
Problems 13 and 14 please
File Ecit Bonk Windw Help brrBack Fon-ardMake Hihligh Make Nor ment Hichlghes Icomln 2ot com to Fi Hand Tool Stat Readnq top Reing Hid:N tion Pae Luyout Josephus(10, 2)should return 5 Contents b. Extend the function to return an NxN array M of ones and zeros, representing alive and dead, encoding the history turn by turn. The first row of M should be all ones, the last row has a single one in the jth column. The syntax should be [j, M]-Josephus (N, k). Write a program that calls the function to get M and devise a graphical display of the deadly history 13. Clipping a vector. Write a function vout-clipVec(v, vmin, vmax) that copies the input vector v to the output vector vout, except if a value is greater than vmax or less than vmin. Values greater than vmax are set to vmax and values less than vmin are set to vmin Check by running this test, which should plot a sine wave clipped level at the tops and bottoms. x-linspace (0, 3, 300); y-sin (2*pi*x) ; plot(x,clipvec(y, -0.9, axis([O, 3, -1, 1]); 0.9)); 14. Swap. Write a function that returns the values of the two inputs in reversed order: function [a,b]=swap (x, y). To use it to swap the values of two variables simply write [v1,v2]=swap (v1,v2) 15. Check if sorted. lype here to searchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started