Borrar filtros
Borrar filtros

Matrix dimensions must agree

3 visualizaciones (últimos 30 días)
Naema
Naema el 7 de Abr. de 2015
Editada: Naema el 8 de Abr. de 2015
I am performing a multiplication in the following equation but, I had this error because the sizes of (resultx) and (etae) are different. The size of (resultx) is 10001x10001 and the size of (etae) is 1x50. Is there a way to let this multiplication work in matlab?. I highly appreciate any help. thanks
Iph1=pinc*(resultx)^2.*(etae/h*v)

Respuestas (1)

Image Analyst
Image Analyst el 7 de Abr. de 2015
No, sorry but there is not. Why do you think it should work?
Which of the 10001 by 10001 elements do you want to multiply by which of the 50 etae elements?
  12 comentarios
Image Analyst
Image Analyst el 8 de Abr. de 2015
Yes, but just to be clearer, since etae is a 2-dimensional matrix, I'd use etae(1,1) instead of etae(1). It will just be a lot more clear what you intend. Then you can use
Iph1=pinc*(resultx).^2*(etae(1,1))./h*v) % for first value
or
Iph1=pinc*(resultx).^2*(etae(1,1))./h/v) % for first value
whichever you want. They give different resuls. I say that neither one is clear and you should use use parentheses around the h*v or h/v to make it crystal clear what you want. Here is what they are equivalent to:
Iph1= v .* pinc*(resultx).^2*(etae(1,1))./h) % for first value
or
Iph1=pinc*(resultx).^2*(etae(1,1))./(h*v)) % for first value
Naema
Naema el 8 de Abr. de 2015
Editada: Naema el 8 de Abr. de 2015
thanks :) I see. I used this:
Iph1=pinc*(resultx).^2*(etae(1,1))./(h*v))

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by