有关matlab的for loop的改写,Rewrite the following MATLAB for loop by using matrix or array operations:for k=1:nx(k) = x(k)+Gx(k)*x(k)+temp/x(k);endNote that your code should perform the same calculation but without the for loop.
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/27 10:30:36
![有关matlab的for loop的改写,Rewrite the following MATLAB for loop by using matrix or array operations:for k=1:nx(k) = x(k)+Gx(k)*x(k)+temp/x(k);endNote that your code should perform the same calculation but without the for loop.](/uploads/image/z/5578450-34-0.jpg?t=%E6%9C%89%E5%85%B3matlab%E7%9A%84for+loop%E7%9A%84%E6%94%B9%E5%86%99%2CRewrite+the+following+MATLAB+for+loop+by+using+matrix+or+array+operations%3Afor+k%3D1%3Anx%28k%29+%3D+x%28k%29%2BGx%28k%29%2Ax%28k%29%2Btemp%2Fx%28k%29%3BendNote+that+your+code+should+perform+the+same+calculation+but+without+the+for+loop.)
有关matlab的for loop的改写,Rewrite the following MATLAB for loop by using matrix or array operations:for k=1:nx(k) = x(k)+Gx(k)*x(k)+temp/x(k);endNote that your code should perform the same calculation but without the for loop.
有关matlab的for loop的改写,
Rewrite the following MATLAB for loop by using matrix or array operations:
for k=1:n
x(k) = x(k)+Gx(k)*x(k)+temp/x(k);
end
Note that your code should perform the same calculation but without the for loop.
有关matlab的for loop的改写,Rewrite the following MATLAB for loop by using matrix or array operations:for k=1:nx(k) = x(k)+Gx(k)*x(k)+temp/x(k);endNote that your code should perform the same calculation but without the for loop.
这个改写应该不难,如下:(注意中间有一个点乘)
x = x + Gx.*x + temp/x;