Matlab question Write the if elseif else statement for the f
Matlab question. Write the if elseif else statement for the following:
Write a function named \'PlaceValue\' that will take in two arguments, the first is the number base and the second is the number of terms to calculate. The function will return the base 10 value of the place values for the number of terms in the system designed. That is PlaceValue (2,6) will return 1,2,4,8,16,32. or PlaceValue(10,3) will return 1,10,100
Solution
Matlab Code
function [ answer ] = PlaceValue( a,b )
i=0;
while(i<b)
answer(i+1) = a^i;
i = i+1;
end
end
Sample Output
>> PlaceValue(2,6)
ans =
1 2 4 8 16 32
>> PlaceValue(10,3)
ans =
1 10 100
