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

5 visualizzazioni (ultimi 30 giorni)
Can you teach my the codes of the attached problem in the picture? I will appreciate your help. thank you. =)
  2 Commenti
Stephen23
Stephen23 il 15 Set 2016
  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.
Kaye Freyssinet  Abanggan
Kaye Freyssinet Abanggan il 15 Set 2016
noted sir. i will surely do this again my own way. thanks for the reminder. more power.

Accedi per commentare.

Risposta accettata

Stephen23
Stephen23 il 15 Set 2016
Modificato: Stephen23 il 15 Set 2016
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 Commenti
Kaye Freyssinet  Abanggan
Kaye Freyssinet Abanggan il 15 Set 2016
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 il 15 Set 2016
Modificato: Stephen23 il 15 Set 2016
@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:

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Type Identification in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by