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

Jan
Jan 2015년 11월 29일
편집: Jan 2015년 11월 29일
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 2015년 11월 29일
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 2015년 11월 29일
See [EDITED] in my answer.

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

답변 (1개)

Jan
Jan 2015년 11월 29일
편집: Jan 2015년 11월 29일

0 개 추천

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.

카테고리

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

태그

질문:

2015년 11월 29일

편집:

2015년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by