Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道在matlab中是否有更有效的方法来执行以下操作
[K, L] = meshgrid(1:sh,1:sv); for i = 1 : sv for j = 1 : sh M = score_mat_temp + a*((K-j).*(K-j) + b*(K-j)) + c*((L-i).*(L-i) + d*(L-i)) + e; end end
因为现在 sv 和 sh 通常是 500 级的速度非常慢
多谢 !
除了最终值之外的所有内容M都被简单地覆盖。所以计算它们是一种浪费。利用
M
[K, L] = meshgrid(1:sh,1:sv); i = sv; j = sh; M = score_mat_temp + a*((K-j).*(K-j) + b*(K-j)) + c*((L-i).*(L-i) + d*(L-i)) + e;