Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Error: Matrices Must Agree

1 Ansicht (letzte 30 Tage)
Kam Selley
Kam Selley am 4 Apr. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hello,
I am attempting to run the below function but I keep getting the error "Error using - : Matrices must agree". I have added as many periods as I thought I needed and still can't get it to work. x1 and x2 are both scalar values. Uunder0 is a (2x1) matrix. The error occurs in my funTRmvn function.
Any help please:
a1 = 2
a2 = 3
b1 = 1
b2 = 4
%function 4
funTRmvn = @(x1,x2) (1./(((2*pi)^(P./2)).*((det(Sigma0)).^(1./2)))).*(exp(((transpose(Uunder0-x1))).*(inv(Sigma0)).*(x2-Uunder0)));
TRmvn = integral2(funTRmvn,a1,b1,a2,b2);
Thanks Kam
  2 Kommentare
Jan
Jan am 5 Apr. 2013
Please post a complete copy of the error message.
per isakson
per isakson am 5 Apr. 2013
Bearbeitet: per isakson am 5 Apr. 2013
Provide values for
P, Uunder0, Sigma0
Do they "agree"? Is funTRmvn supposed to return a real value?
Proposal:
  • rename a1, a2, b1 and b2 to xmin, xmax, ymin and ymax
  • implement funTRmvn as an ordinary function and debug it carefully

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by