Index exceeds matrix dimensions
Ältere Kommentare anzeigen
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 -> constant
x2 -> 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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!