Filter löschen
Filter löschen

How do I input the following commands in Matlab?

1 Ansicht (letzte 30 Tage)
Chris Herdelin
Chris Herdelin am 2 Sep. 2021
Kommentiert: Chris Herdelin am 3 Sep. 2021
% a simple matlab program with matrix commands
x = [1 2 3; 4 5 6; 7 8 9];
disp x;
disp(x);
y = [11 22 23; 14 15 16; 17 18 19];
z=x+y;
w=x-y;
u= x*y;
a=[x, y];
b=[x; y];
c=x(:,2);
d=y(:,1);
e=x(2,3);
a) Create the preceding program and run it in Matlab and describe what each line of this
program does.
b) Add a line to this program which creates a new matrix, f, which is the transpose of x.
c) Add a line to this program which creates a new matrix, g, which is the identity matrix
plus x.

Antworten (1)

Walter Roberson
Walter Roberson am 2 Sep. 2021
At the MATLAB command line, give the command
edit
That will bring up the MATLAB editor. Copy and paste those commands into the edit window that is brought up. When you are done, click the green Run button.
The first time you do that, it will prompt you to select a file name to save the file to; choose something appropriate (must start with an English letter A to Z or a to z, but characters after that can be letters or arabic numerals 0 to 9, or underscore). MATLAB will remember the name you select, and you will not be prompted to choose a name the next time you press the green Run button.
  1 Kommentar
Chris Herdelin
Chris Herdelin am 3 Sep. 2021
Thanks! What is the command for the identity matrix + another matrix, x?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Entering Commands finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by