Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to make a multiplication table in MATLAB, so a matrix A such that A(ij)=i.j, 1

I have to make a multiplication table in MATLAB, so a matrix A such that A(ij)=i.j, 1<=i,j<=n.

For example, for n=4 I should get:

A= [1 2 3 4

2 4 6 8

3 6 9 12

4 8 12 16]

But this code does not work:

function table= multtable(n)

for i = 1, n

for j = 1, n

A(i:j) = n * j

end

end

end

What is wrong with it? How can I improve it?

Thanks in advance.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is Disintermediation? Outsourcing

Answered: 1 week ago