Question: I need help on the actual code esp the looping structure from within matlab Homework Class 8. This assignment is due at the start of
I need help on the actual code esp the looping structure from within matlab

Homework Class 8. This assignment is due at the start of class on Wednesday Sept 20 Task4. Input two variables A and B. Test each variable to insure that they are positive integers. Develop an algorithm to determine the smallest power of A that is greater than B. For example, A-2 and B-9. A-2; A-4; A3-8: A-16. So, we want to return the value "4" since A-16> 9. Note, this requires a looping structure. Document your algorithm using both a flow diagram and pseudocode. Now prepare a Matlab script for this problem called Power_Calculator.m. Your program should input A and B, Calculate the smallest power of A that is greater than B, and output the smallest power. Ado comments to your program, such that if someone typed help Power_Calculator in the Command Window, comments would be displayed in the Command Window that described what the program is supposed to do, the types of inputs, and the types of outputs. You will also need to test to see if A and B are positive integers. Save your matlab file and submit it plus your algirithms through the submission box. Testing for integers. This is not straight forward. For example if you use the Matlab function isinteger, for A -9, the function isinteger(A) would return a value of false. This is because the input for A is entered in floating point by default, and not as an integer. So values of 1, 2.3, 9, 10.145, etc, when tested with the isinteger function, all return a value of 0 (or false). The easiest way to test to see if a number is to use the mod function. For r=mod(An), A is the dividend, n is the divisor, and r is the remainder after A is divided by n. So if A-3.14, then for b=mod(A,1) then b= 0.14 which is the remainder. But if A is an integer such as A-34, then for b mod(A,1) will give b-0. (Note: b this is a real number, equal to zero, and not a Boolean "false" output). So to test if the values are intergers, as a condition, use mod(A,1)-=0 and mod(B,1)-=0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
