function file used with 2 Matrices as input
So the goal is to achieve correspondign AOU (oxygen data that can be compared to other types of O2 data) using two 4D matrixes (100 x 100 x 19 x 5 which is Longitude x Latitude x Depth x Time), one called SAL (giving Salinity values) and the other TEMP_K (Temperature in Kelvin).
The formula I want to use to calculate would be:
ln(O2 in µmol/kg) = – 173.9894 + 255.5907(100/TK) + 146.4813 ln(TK/100) – 22.2040(TK/100) + Sal [-0.037362 + 0.016504(TK/100) – 0.0020564(TK/100)2]
I tried to create a function file, giving me ln_AOU as well as AOU as output if I pull up the function, put it tells me there is an error ("Not enough input"). I think, there is something I’m generally missing, my experience with matlab is very limited, so I’d appreciate some help.
function [ln_AOU, AOU] = AOU(TEMP_K, SAL)
%Should transform the values of O2 into AOU
ln_AOU_TEMP = (- 173.9894) + 255.5907.*(100./TEMP_K) + 146.4813.* log(TEMP_K./100) – 22.2040*(TEMP_K./100) + SAL.*(0.016504.*(TEMP_K./100) – 0.0020564.*(TEMP_K./100).^2);
AOU = exp(ln_AOU);
endSo the goal is to achieve correspondign AOU (oxygen data that can be compared to other types of O2 data) using two 4D matrixes (100 x 100 x 19 x 5 which is Longitude x Latitude x Depth x Time), one called SAL (giving Salinity values) and the other TEMP_K (Temperature in Kelvin).
The formula I want to use to calculate would be:
ln(O2 in µmol/kg) = – 173.9894 + 255.5907(100/TK) + 146.4813 ln(TK/100) – 22.2040(TK/100) + Sal [-0.037362 + 0.016504(TK/100) – 0.0020564(TK/100)2]
I tried to create a function file, giving me ln_AOU as well as AOU as output if I pull up the function, put it tells me there is an error ("Not enough input"). I think, there is something I’m generally missing, my experience with matlab is very limited, so I’d appreciate some help.
function [ln_AOU, AOU] = AOU(TEMP_K, SAL)
%Should transform the values of O2 into AOU
ln_AOU_TEMP = (- 173.9894) + 255.5907.*(100./TEMP_K) + 146.4813.* log(TEMP_K./100) – 22.2040*(TEMP_K./100) + SAL.*(0.016504.*(TEMP_K./100) – 0.0020564.*(TEMP_K./100).^2);
AOU = exp(ln_AOU);
end So the goal is to achieve correspondign AOU (oxygen data that can be compared to other types of O2 data) using two 4D matrixes (100 x 100 x 19 x 5 which is Longitude x Latitude x Depth x Time), one called SAL (giving Salinity values) and the other TEMP_K (Temperature in Kelvin).
The formula I want to use to calculate would be:
ln(O2 in µmol/kg) = – 173.9894 + 255.5907(100/TK) + 146.4813 ln(TK/100) – 22.2040(TK/100) + Sal [-0.037362 + 0.016504(TK/100) – 0.0020564(TK/100)2]
I tried to create a function file, giving me ln_AOU as well as AOU as output if I pull up the function, put it tells me there is an error ("Not enough input"). I think, there is something I’m generally missing, my experience with matlab is very limited, so I’d appreciate some help.
function [ln_AOU, AOU] = AOU(TEMP_K, SAL)
%Should transform the values of O2 into AOU
ln_AOU_TEMP = (- 173.9894) + 255.5907.*(100./TEMP_K) + 146.4813.* log(TEMP_K./100) – 22.2040*(TEMP_K./100) + SAL.*(0.016504.*(TEMP_K./100) – 0.0020564.*(TEMP_K./100).^2);
AOU = exp(ln_AOU);
end function, matlab function, input, sum MATLAB Answers — New Questions