Question: PLease answer the question with proper functions using matlab 1. Write a function that takes two inputs (maximum and divisor as scalars) and returns to
PLease answer the question with proper functions using matlab
1. Write a function that takes two inputs (maximum and divisor as scalars) and returns to outputs (the numbers evenly divisible and the numbers not evenly divisible as vectors).
This function must use a for-loop
The function should determine for all positive integer numbers up to and including the maximum, if the number is evenly divisible by the divisor.
For Honors Credit, rewrite this function using a while-loop
2. Write a function that takes two inputs (maximum and divisor as scalars) and returns to outputs (the numbers evenly divisible and the numbers not evenly divisible as vectors).
This function must be vectorized (no looping)
The function should determine for all positive integer numbers up to and including the maximum, if the number is evenly divisible by the divisor.
Attempt for question 1

function [Integer, noninteger ]= Question 1(m,d) %m= scalar (maximum) %d= scalar (divisor) k=0; l=0; for i=1:1:m if mod(i,d)==0 l=1+1; integer (1)=i; return else k=k+1; noninteger (k)=i; end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
