How can I solve this MATLAB “Matrix dimensions must agree” error?

前端 未结 2 1775
北恋
北恋 2021-01-21 12:27

I am typing some code for a class but every time I run the function I get the same error:

??? Error using ==> plus
Matrix dimensions must agree.

Error in ==&         


        
2条回答
  •  故里飘歌
    2021-01-21 12:54

    How do you expect -x2.^2-y1.^2 to work when x2 and y1 is of different size? x2=0:0.1:5 has fifty or so entires while y1=-5:0.1:5 has a hundred or so entries.

提交回复
热议问题