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 commentaires

Jan
Jan le 29 Nov 2015
Modifié(e) : Jan le 29 Nov 2015
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
Daniel Siwiec le 29 Nov 2015
Yea, I'm new in computer programing and Im not to familiar with computer vocabulary.
Lets say that W takes 64 bits in computer memory is there any way to make it samller? I tried to make it like this but i got no idea how to check if its ok.
y=int8(W)
Jan
Jan le 29 Nov 2015
See [EDITED] in my answer.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 29 Nov 2015
Modifié(e) : Jan le 29 Nov 2015

0 votes

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.

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by