intquad function woes....
Show older comments
I wrote this (homework) function that creates a large matrix from the sub-matrices (0), (1), (2) and (3) so that it will be in this form: (0) has all its element "0" etc.
(0) (1)
(3) (2)
=========
function [M] = intquad(m,n)
a = zeros(m,n);
b = ones(m,n);
c = b*2;
d = b*3;
M = [a b ; d c];
I went through each line in the command window and it worked flawlessly. I RAN x=intquad(m,n) with many combinations of (m,n) and got the expected outputs.
BUT, when I tested this function via HW4.p (yes, the Coursera brand) it tells me the function is incorrect and that
"Feedback: Your function made an error for argument(s) 2, 3 "
My questions are:
1. If the function is flawed, where lies the culprit?
2. What is meant by "argument(s) 2, 3" ?
Thanks
My apologies, it is my 1st/ posting here, and the Preview window does not make much sense.
3 Comments
Walter Roberson
on 7 May 2017
Please post the details of the homework question, as there might be something subtle in the requirements.
reuven zac
on 7 May 2017
Edited: Walter Roberson
on 8 May 2017
Prashanth Reddy Penta Reddy
on 20 May 2017
Edited: Walter Roberson
on 25 Apr 2018
function M = intquad1(m,n)
a = zeros(m,n);
b = ones(m,n);
c = b*2;
d = b*3;
M = [a b ; c d];
You did it right. Just interchange c and d in the final step.
Accepted Answer
More Answers (1)
Liban Abu
on 23 Apr 2018
Edited: Walter Roberson
on 25 Apr 2018
I started of with something like this
%Q(1:2:n, end:end:m)=1
%Q(end:end:n, end:end:m) =3
stuck on how to get the 2's on bottom Left
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!