Hi Guys
So I have a matrix
a = [16 456 22 85 93;
11 78 310 62 36;
1 66 23 67 405]
how would I add/delete row or column in the matrix? - plot a graph, hold on/hold, turn on grid and label x and y axis?
thank you :)

댓글 수: 3

Jan
Jan 2016년 5월 2일
What exactly is your question? Adding deleting rows/columns is explained exhaustively in the Getting Started chapters of the documentation. You find descriptions there also about how to plot a graph, the hold command, labels and grids. So do you aks to rephrase the documentation? Simply use the help and doc commands.
Stephen23
Stephen23 2016년 5월 2일
편집: Stephen23 2016년 5월 2일
You got links for all of those topics in answer to your earlier question:
Has something changed since you received (and accepted) that answer?
Adding and accessing elements to arrays is a very basic MATLAB usage that you would be better off learning by doing these introductory tutorials:
We are volunteers, not a private tutorial service: the internet has thousand of MATLAB tutorials that will teach you how to to start using MATLAB.
Laura McHugh
Laura McHugh 2016년 5월 2일
Hi Stephen
Thank you for your reply, I wanted to ensure that the answers are correct and I am going in the right direction

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2016년 5월 2일

1 개 추천

Here you go:
a = [16 456 22 85 93;11 78 310 62 36;1 66 23 67 405];
% Add Row:
a = [a; randi(99, 1, 5)];
% Add Column:
a = [a, randi(99, 4, 1)];
% Delete Row #2:
a(2,:) = [];
% Delete Column #2:
a(:,2) = [];
% Redefine ‘a’:
a = [16 456 22 85 93;11 78 310 62 36;1 66 23 67 405];
x = 1:size(a,2); % Create ‘x’ Variable
figure(1)
plot(x, a(1,:), '-b')
hold on
plot(x, a(2,:), '.-r')
hold off
grid
xlabel('Time (nanoseconds)')
ylabel('Velocity (Furlongs/Fortnight)')

댓글 수: 3

Laura McHugh
Laura McHugh 2016년 5월 2일
Thank you for taking time to answer this, wanted to ensure that I am using matlab correctly and these answers are great
Star Strider
Star Strider 2016년 5월 2일
My pleasure.
When I was in initially learning MATLAB, there were a half dozen of us in the Control Engineering computer lab learning control systems and MATLAB simultaneously. We discovered different things at different times, and helped each other learn both. When it came time to do our own work and not collaborate, we all did well. This was about 17 years before MATLAB Answers began. MATLAB was much smaller then as well, and it was much easier to find information in the documentation (which were all only hardcopy back then, and for the Student Edition, in a single book).
Laura McHugh
Laura McHugh 2016년 5월 2일
The documentation and materials I have are good, sometimes it just taking another persons view to ensure you're on the right track with answers, can I ask when adding rows/ columns what randi means?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

the cyclist
the cyclist 2016년 5월 2일

1 개 추천

Your question is effectively "How do I use MATLAB?"
Rather than explain that here, which might take up a bit of space, let me point you to this tutorial page.

카테고리

도움말 센터File Exchange에서 Networks에 대해 자세히 알아보기

태그

질문:

2016년 5월 2일

댓글:

2016년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by