# Can't figure out why the integral() command is returning error "Matrix dimensions must agree", but they do agree.

2 visualizzazioni (ultimi 30 giorni)
George Pence il 27 Set 2016
Risposto: Zhao Wang il 29 Set 2016
I'm working on an assignment that requires finding the response of an RL circuit via convolution. Currently, I have written an anonymous function for the impulse response of the circuit and the input waveform that will be fed to the circuit.
The response needs to be the convolution of these two signals, multiplied by an exponential function we were required to write (for some reason not allowed to use built-in exp()).
I'm wondering if anyone can help me to figure out why the integral command is giving me a vague "Matrix dimensions must agree" when the two signals multiplied together and used in the integral are exactly the same size. I've split up the formula into multiple parts and verified that all matrices are the same size, so I'm very confused as to how to continue troubleshooting this problem.
In the screenshot attached you can see the test_x and test_y variables, which are the different parts of the end result. test_x is what is actually supposed to be integrated.
I'm still very inexperienced with efficient use of anonymous functions, especially when it comes to integrating with them, so any tips or advice on how to make this easier in the future will also be greatly appreciated.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
John D'Errico il 27 Set 2016
Do you honestly expect anyone to be able to read the image you posted with that tiny, fuzzy print? Paste it in as text.

Accedi per commentare.

### Risposte (1)

Zhao Wang il 29 Set 2016
I understand that you want to integrate a function over time using the "integral" function. The error message is that "Matrix dimensions must agree". This error message may be caused by the vector 't' (with a dimension 1X1101 in your case) in the expression of function 'x_t'.
For more details about the "integral" function, refer to the following link:
If you want to approximate the integral of a function by summing its value at each step, you can use the "cumsum" function. Details of the "cumsum" function can be found at:
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su MATLAB in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by