inv(W) problem
14 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jan
on 29 Nov 2015
Edited: Jan
on 29 Nov 2015
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.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!