Borrar filtros
Borrar filtros

Error Plotting a function - Matrix Dimensions must agree

2 visualizaciones (últimos 30 días)
Hi,
I am new to MATLAB, I am getting the following error
"Error using / Matrix dimensions must agree.
Error in ParticleVelocityvsParticleSize (line 37)
VP1=M*((G*R*Stagnation_Temperature)/(1+((G-1)/2)*M^2))^0.5*((3*Cd*Gas_Density*x)/(2*Powder_Density*Powder_Size*10^(-6)))^0.5"
The code consists of getting the input of all the variables from the user. I need to plot the VP1 vs Powder_Size graph, with varying Powder_Size from 10 to 45.
Powder_Size=linspace(10,45,100)
VP1=M*((G*R*Stagnation_Temperature)/(1+((G-1)/2)*M^2))^0.5*((3*Cd*Gas_Density*x)/(2*Powder_Density*Powder_Size*10^(-6)))^0.5
plot(Powder_Size,VP1)
Can anyone please help me with this. Thanks in advance.
  1 comentario
Mathieu NOE
Mathieu NOE el 2 de Abr. de 2021
hello
the error comes from the fact that you are not using dot product or dot division in your expression;

Iniciar sesión para comentar.

Respuesta aceptada

Shubham Khatri
Shubham Khatri el 6 de Abr. de 2021
Hello,
The error occurs because the matrix you are trying to multiply are not compatible with each other for multiplication due to the difference in number of elements in each matrix. Please check the size of each matrx you are multiplying and see if they can be multiplied. Also, if they are compatible, there is a need to use '.' (element operation) . For more information, please see this documentation link.
Hope it helps

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by