I am attempting to fit a set of data simultaneously with two varying inputs: the temperature and h-constant. Both of these inputs are in single row, 400-element vector. The fundamental piece of my code is the function B that takes two inputs (scalars x and h) and outputs a column vector of 43 elements -- the 43 elements are based off of the "nu" vector (frequency) input. From my understanding, to achieve the best fit of the .txt file I implemented, I have to consider the initial temperature evaluated with ALL 400 h-constants and repeat that for the other 399 temperatures. As such, it seems like I need 160,000 outputted column vectors. So that's why I have a 43x160000 matrix.
The plan is to take each temperature and cycle through each h-constant before continuing on with the next T(i) value. Each column of my "md" matrix will be the output of the B function. The problems I'm encountering are that: the columns repeat themselves and that the output in the matrix doesn't match the numbers (example like B(T(1),H(1)) in the command window --> this should be the first column in "md" but it's not). I think the crux of the problem lies in the loop statement. Where did I misstep? How can I ensure the output replaces each column in the large matrix, accounting for every single T and h? I've attached the .txt file if the need arises. Thank you.
c=2.9979*10^(8); k=1.3806504*10^(-23) ; J=2/c^2;
B= @(x,h) 10^(20)*J*h*(nu.^3./(exp((h*nu)./(k*x))-1));