Help with Matlab homework question

6 ビュー (過去 30 日間)
Bobby
Bobby 2011 年 11 月 21 日
コメント済み: Steven Lord 2020 年 8 月 28 日
Use loops to vreate a 4 x 3 matrix in which the value of each elemen is the sum of its row number and its column number divided by the square of its column number. for example the value of element (2,3) is (2+3)/3^2 = 0.5555 I tried : for i=2:5 a(i)=i(2+3)/3^2 end a not sure what I am doing wrong can y please help!
  5 件のコメント
Sven
Sven 2011 年 11 月 21 日
You've come to the right place. You just need to read this:
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
And probably this:
http://www.mathworks.com/help/techdoc/learn_matlab/bqr_2pl.html
Steven Lord
Steven Lord 2020 年 8 月 28 日
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

サインインしてコメントする。

採用された回答

bym
bym 2011 年 11 月 21 日
you are going to need 2 loops:
x = zeros(10)
for r = 1:10
for c = 1:10
x(r,c) = % for you to fill in
end
end
  1 件のコメント
Bobby
Bobby 2011 年 11 月 21 日
thank you

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 11 月 21 日
No loops are necessary if you use ndgrid.
  1 件のコメント
Bobby
Bobby 2011 年 11 月 21 日
Thanks

サインインしてコメントする。


Sean de Wolski
Sean de Wolski 2011 年 11 月 21 日
I answered the exact same homework question here:
  1 件のコメント
Bobby
Bobby 2011 年 11 月 21 日
thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by