Effacer les filtres
Effacer les filtres

Error Plotting a function - Matrix Dimensions must agree

2 vues (au cours des 30 derniers jours)
Saumya Nagar 17BME0447
Saumya Nagar 17BME0447 le 2 Avr 2021
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 commentaire
Mathieu NOE
Mathieu NOE le 2 Avr 2021
hello
the error comes from the fact that you are not using dot product or dot division in your expression;

Connectez-vous pour commenter.

Réponse acceptée

Shubham Khatri
Shubham Khatri le 6 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by