Ältere Kommentare anzeigen
I got 2 problems:
1 is inv(W) i don't get why i matlab gives me this all the time
"Error using inv
Matrix must be square.
Error in laborki1 (line 39)
inv(W)
"
2. I am suppous to make W take as low place in computer memory as it is possible and I'm not sure if I did it well. If someone could explain me how does it work it would be grate.
So here i my script:
clc
disp('Daniel Siwiec')
disp('Polecenie 1')
A=[1,2,3;4,5,6;7,8,9]
B=[2,3,4;5,6,7;8,9,10]
A.*B
B.*A
A./B
B./A
disp('Polecenie 2')
W=[1,3,5,7,9,11]
W=[1:2:11]
y=int8(W)
x=input('Podaj liczbe X przez ktora zostanie przemnozony wektor W:')
x*W
disp('Polecenie 3')
size (A)
length (A)
max (A)
min (A)
sum (A)
inv (A)
size (W)
length (W)
max (W)
min (W)
sum (W)
inv(W)
3 Kommentare
Please format your code properly in the forum using the "{} Code" button. Use one command per line.
I do not understand this:
I am suppous to make W take as low place in computer memory
as it is possible.
Daniel Siwiec
am 29 Nov. 2015
Jan
am 29 Nov. 2015
See [EDITED] in my answer.
Antworten (1)
Only square matrices can be converted, as teh error message explains clearly. Inverting non-suqare matrices is not defined mathematically. Therefore it is not possible to guess, what you want to achieve.
[EDITED] The int8 command converts the input to signed 8 bit integers. The whos command shows, that this uses less memory. But note, that inv is not supported for integer types. So perhaps you search for single precision, which uses 4 bytes per value.
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!