Need help with a question
Mostra commenti meno recenti
Write a function in MATLAB to return a look-up table (array) of transformed numbers. The transformed numbers are the numbers in row 1 and column 1. The first number passed to the function is the starting number for the column (lowest value). The second number is the ending value for the column. The third number is the starting value for the row and the fourth number is the ending value for the row. The last number is the increment for both the row and column. The column will have numbers less than 100 and the row will have numbers greater than 2. The first row in the table will begin at 0. The first column in the table, beginning in row 2, will be the beginning value for the column. When the table is complete, you can look down the column and across the row to see the transformed value for that row and column value.
Use loops and indexing for the calculations. Do not use MATLAB-specific indexing operators ‘:’ and ‘end’, such as A(: , 3) or A(: , end).
For example, if the function is named ‘Transform()’ and is called with:
array=Transform(-5,25,7,25,5), MATLAB will display:
array =
0 7.0000 12.0000 17.0000 22.0000
-5.0000 31.0383 53.3006 81.2439 113.8699
0 35.5203 58.5692 87.0928 120.1891
5.0000 40.0022 63.8378 92.9417 126.5084
10.0000 44.4842 69.1064 98.7906 132.8277
15.0000 48.9662 74.3750 104.6395 139.1470
20.0000 53.4482 79.6436 110.4884 145.4662
25.0000 57.9301 84.9122 116.3373 151.7855
Use this function to calculate
function transform=CalcTrans(num1,num2)
% calculate a numerical transformation factor given two numbers
% num2 must be less than 100, num1 must be greater than or equal to 2
% If conditions not met, error returned as -999.
if num2>=100 || num1<2
transform=-999
else
transform=17+0.5*num2*num1^0.3+num1*sqrt(num1); % Emphrical equation
end
end % end function
2 Commenti
Walter Roberson
il 9 Dic 2019
That question does not make sense.
For one thing, the function that they say to use to calculate the transform requires two inputs, but the question does not describe any inputs to be passed to it.
I can make guesses, but the question is oddly specific in what it does say, even while not saying other important things, so there is too much risk that my guesses would be wrong.
chargerfan97
il 9 Dic 2019
Risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!