divide matrix with different sizes

hi i wanna divide two matrix with different size one of them have 2 rows and 54 columns and another one have 2 rows and 16 columns. I'm trying element by element to divide but it's not appropriate. please help me what should I do with something like for loop or that kind of things.
thanks for devote your time for me

답변 (1개)

Walter Roberson
Walter Roberson 2016년 8월 4일

0 개 추천

If the two matrices are A and B then possibly you want A\B (which will be 54 x 16) or B\A (which will be 16 x 54)

댓글 수: 5

mohamad almasi
mohamad almasi 2016년 8월 4일
hi wlter, thank for your attention actulay A/B. that A is 2x54 and B is 2x16
You cannot do A/B . The / operator, whose formal name is mrdivide documents,
The matrices A and B must contain the same number of columns.
What is the size of output that you want? And how do you want to define the output mathematically. If C were the result of the division, then for any given index J, K, what should C(J,K) be defined as?
mohamad almasi
mohamad almasi 2016년 8월 4일
your advice is really correct and useful. I cant divide with /. and I do it with \. but unfortunately it's seem not appropriate for running in .m file. i means I run my divided separately in command window, but they didn't run in my .m file script. Matrix dimensions must agree.
Error in estimate_vector3 (line 25) arr_x = x\T1; Error in start (line 179) left_vector=estimate_vector3(left_cord,t,50);
Stephen23
Stephen23 2016년 8월 4일
편집: Stephen23 2016년 8월 4일
"unfortunately it's seem not appropriate for running in .m file"
Why would MATLAB not let you use MATLAB operators in a MATLAB function? Using MATLAB operations in MATLAB scripts and functions is not the problem. Check the dimensions of the variables before you call that command:
size(x)
size(T1)
arr_x = x\T1
Your t appears to be mostly made up of toc() results. toc() is not measuring some kind of external time as the frames progress: toc() is measuring execution time of the MATLAB code itself, and those times can vary widely. For example,
>> tic;m = 6; toc
Elapsed time is 0.060407 seconds.
>> tic;m = 6; toc
Elapsed time is 0.000070 seconds.
Your use of toc for your t vector looks very suspicious to me.

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

카테고리

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

질문:

2016년 8월 4일

댓글:

2016년 8월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by