When I run the following code, matlab shows me an error that the index exceeds matrix dimensions. It seems like it has an easy solution, but I am still relatively new to matlab and coding in general.
Some background info if required, I'm trying to validate a thermal model and x2 is reduced temperature and yp is predicted thermal efficiency. p1 and p2 depict my thermal coefficients.
Hope you can help me out!
k1 -> constantx2 -> 100x1 (double)p1 = [0:0.1:10]; %100 elements
p2 = [0:0.001:1]; %1000 elements
for m=1:length(p1) for n=1:length(p2) yp(m,n) = ((k1.*p2(m,n))./(p1(m,n)+p2(m,n)))-((x2(m,n).*(p1(m,n).*p2(m,n)))./(p1(m,n)+p2(m,n))); end end
Best Answer