# Error using...Plus....matrix dimensions must agree

**URL:** <https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156>\
**Category:** SMM/GMM/IRF-Matching\
**Created:** [9 February 2020 14:21 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156 "2020-02-09T14:21:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [9 February 2020 14:21 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/1 "2020-02-09T14:21:58Z")

</div>

I am running model based on IRF-MATCHING Approach. I am getting message as:

Error using +  
Matrix dimensions must agree.  
Error in csminit (line 125)  
dxtest=x0+dx’\*lambda;  
Error in csminwel (line 101)  
[f1 x1 fc retcode1] = csminit(fcn,x,f,g,badg,H,varargin{:});  
Error in IRFNEW (line 295)  
[fhat,x\_opt\_hat]=csminwel(@IRF\_matching\_objective,x\_start,H0,[],crit,nit,IRF\_empirical,IRF\_weighting);  
Error in dynare (line 235)  
evalin(‘base’,fname) ;

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [9 February 2020 15:28 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/2 "2020-02-09T15:28:33Z")

</div>

Without seeing the codes, it is impossible to tell.

---

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [9 February 2020 16:02 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/3 "2020-02-09T16:02:32Z")

</div>

here is code[IRFNEW.mod](https://forum.dynare.org/uploads/short-url/dUmQVKa0bt7ZsUKDRxcnH2Xodsp.mod) (5.0 KB) [IRF\_matching\_objective.m](https://forum.dynare.org/uploads/short-url/n0u8NXQ82jSZTPlDb3MHhaePEqa.m) (1.1 KB) [get\_empirical\_IRFs.m](https://forum.dynare.org/uploads/short-url/qVh9SaPjSDhX9nrFZxyu3SWGRku.m) (5.7 KB) [build\_companionform.m](https://forum.dynare.org/uploads/short-url/xiANripxanl9BHfiRnUoGtk3nZh.m) (608 Bytes)

---

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [9 February 2020 16:16 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/4 "2020-02-09T16:16:09Z")

</div>

sir plz suggest regarding these errors

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [9 February 2020 19:10 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/5 "2020-02-09T19:10:51Z")

</div>

Which Dynare version and which `csminwel` are you using?

---

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [9 February 2020 19:17 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/6 "2020-02-09T19:17:10Z")

</div>

that problem is solved as I have changed the upper and lower bounds.  
now error is:  
Output argument “IRF\_model” (and maybe others) not assigned during call to “IRF\_matching\_objective”.  
Error in IRFNEW (line 285)  
[fval,IRF\_model]=IRF\_matching\_objective(x\_opt\_hat,IRF\_empirical,IRF\_weighting);  
Error in dynare (line 235)  
evalin(‘base’,fname) ;

---

<div class="post-metadata">

**Author:** ![Dsge3](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/e95f7d/32.png) [@Dsge3](https://forum.dynare.org/u/Dsge3)\
**Post date:** [14 June 2020 10:40 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/7 "2020-06-14T10:40:08Z")

</div>

Dear Madihaatif,  
thank you for your message, I could use your help if you have found the source of the problem. I have the same.

Thanks in advance  
Best

---

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [14 June 2020 11:12 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/8 "2020-06-14T11:12:27Z")

</div>

what problem you are facing?

---

<div class="post-metadata">

**Author:** ![Dsge3](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/e95f7d/32.png) [@Dsge3](https://forum.dynare.org/u/Dsge3)\
**Post date:** [14 June 2020 11:23 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/9 "2020-06-14T11:23:18Z")

</div>

I received the exact same error message as yours.  
Output argument “IRF\_model” (and maybe others) not assigned during call to “IRF\_matching\_objective”

Thanks for your help

---

<div class="post-metadata">

**Author:** ![Madihaatif](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Madihaatif](https://forum.dynare.org/u/Madihaatif)\
**Post date:** [14 June 2020 11:46 UTC](https://forum.dynare.org/t/error-using-plus-matrix-dimensions-must-agree/15156/10 "2020-06-14T11:46:01Z")

</div>

share your 'IRF\_matching\_objective". I resolved issue using forum. may be it helps for you also
