# How can I correct this error?

3 views (last 30 days)
Kangmin Lee on 26 Apr 2021
Answered: Divija Aleti on 29 Apr 2021
>> x=0:0.1:30;
>> y=-10:0.1:10;
>> [X,Y] = meshgrid(x,y);
>> syms u
>> A = (8*9.81/(27))*(cosh(0.01*u))^2*cos((9.81/9*X*cosh(0.01*u))*cos((9.81/9)*Y*cosh(0.01*u)*sinh(0.01*u))*exp(-(9.81/9)*(cosh(0.01*u))^2*2));
다음 사용 중 오류가 발생함: * (334번 라인)
Dimensions do not match.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (1)

Divija Aleti on 29 Apr 2021
Hi Kangmin,
Have a look at the following snapshot of your code:
The matrix above the blue line and the matrix above the red line are of the same dimensions,i.e.,201 x 301. In order to multiply two matrices using (*), the number of columns in the first matrix should be equal to the number of rows in the second matrix. But here, that is not the case. This is why you are getting the error.
Depending on the problem you are solving, you can either use the dot operator with multiplication(.*) which multiplies the matrices element-wise, or take the transpose of one of the matrices and perform normal multiplication. The ‘regular’ matrix transpose (') creates the complex-conjugate transpose of a complex vector or matrix. Using the (.') creates the transpose without doing the complex-conjugate operation.
For more infomation, refer to this link: Array vs.Matrix Operations
Hope this helps!
Regards,
Divija
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Creating and Concatenating Matrices 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!