30 views (last 30 days)

Show older comments

Aquatris
on 31 May 2020

This might be what you are looking for

A = rand(13,4); % random 13x4 matrix

[r,c] = size(A); % get number of rows and columns of A

for i = 1:c % columns 1 to c

figure(1)

subplot(c,1,i),plot(A(:,i)) % plot the ith column in ith graph in figure(1)

%subplot(1,c,i),plot(A(:,i)) % alternative for horizontal layout

end

Earth Sugandhi
on 3 Feb 2021

Prasad Reddy
on 31 May 2020

% let us suppose your matrix is A,and you want toplot all the columns of A with espect to dome other variable. You havent mentioned that variable in the question. i am considering it as ' t ' .

the code will be as follows.

clc

clear all

A=[] % your matrix.

t=[] % the x axis variable. it should have same number of elements as of the elements in one column of A ie 13.

for i=1:4

plot(t,A(:,i)

hold on

end

% this code will work. message here if you find any difficulty. Give me a up thumb if this helps to you. Thanks.

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

Start Hunting!