Can you guys help me with my ASSIGNMENT? i just don't know how to answer it =(

3 次查看(过去 30 天)
Can you teach my the codes of the attached problem in the picture? I will appreciate your help. thank you. =)
  2 个评论
Stephen23
Stephen23 2016-9-15
  1. When you don't bother to try solving your own homework then you won't learn anything.
  2. Copying someone's work and pretending that it is your work is called plagiarism. Look it up.

请先登录,再进行评论。

采纳的回答

Stephen23
Stephen23 2016-9-15
编辑:Stephen23 2016-9-15
Method one: bsxfun
>> n = 5;
>> bsxfun(@plus,n:-1:0,(0:n)')
ans =
5 4 3 2 1 0
6 5 4 3 2 1
7 6 5 4 3 2
8 7 6 5 4 3
9 8 7 6 5 4
10 9 8 7 6 5
Method two: toeplitz
>> toeplitz(n:2*n,n:-1:0)
ans =
5 4 3 2 1 0
6 5 4 3 2 1
7 6 5 4 3 2
8 7 6 5 4 3
9 8 7 6 5 4
10 9 8 7 6 5
  4 个评论
Kaye Freyssinet  Abanggan
my instructor said we can ask help in here sir, and thats because he is also not that good in matlab. thats it. can i ask a starting code or clue to do it sir? then i'll be the one to continue it.
Stephen23
Stephen23 2016-9-15
编辑:Stephen23 2016-9-15
@Kaye Freyssinet Abanggan: one way would be to create two loops, one nested inside the other, and use indexing to access the element:
n = 5
out = zeros(n+1);
for row = 1:n+1
for col = 1:n+1
out(row,col) = ???
end
end
All you need is one addition and one subtraction where the ??? is and this will work. I will leave this up to you to figure out. These tutorials are an excellent way to start using MATLAB:

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by