How to fix "Error using /, Matrix dimensions must agree"
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rafael
el 12 de Abr. de 2024
Editada: the cyclist
el 12 de Abr. de 2024
I'm just tryng to create a simple graph to display how some values change depedning on another variable, but for some reason it is not working. I do not know what to do.
Here is the code:
Fw=195*9.81;
CD=2.125;
BD_var = 0.1:0.01:CD;
MinFh=(Fw*CD*cosd(45))/(BD_var);
MaxFh=(Fw*CD*cosd(0))/(BD_var);
figure(2)
ax = axes;
plot(BD_var,MinFh)
title('Minimum Force on HC for Varying Distances')
axis ([0 inf 0 inf])
xlabel('Distance [m]')
ylabel('Force [N]')
0 comentarios
Respuesta aceptada
the cyclist
el 12 de Abr. de 2024
Editada: the cyclist
el 12 de Abr. de 2024
I used element-wise division (using ./ rather than /) in your code:
Fw=195*9.81;
CD=2.125;
BD_var = 0.1:0.01:CD;
MinFh=(Fw*CD*cosd(45))./(BD_var);
MaxFh=(Fw*CD*cosd(0))./(BD_var);
figure(2)
ax = axes;
plot(BD_var,MinFh)
title('Minimum Force on HC for Varying Distances')
axis ([0 inf 0 inf])
xlabel('Distance [m]')
ylabel('Force [N]')
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Discrete Data Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!