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

PLease answer the question with proper functions using matlab 1. Write a

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!