I am not getting a graph when I plot

%Two arrays, one for pump voltage, another for the constant height
vp=[4 5 6 7 8 9 10];
h=[.009 .025 .048 .078 .11 .164 .20];
% system Parameters
Dc = 0.04445; % Diameter of tank in [m]
Do = 0.0047625; % Diameter of orifice in [m]
g = 9.81; % Gravitational acceleration in [m/s^2]
Ac = .0015518; % Cross-sectional area of tank based on diameter in [m^2]
Ao = .0000178; % Cross-sectional area of orifice based on diameter in [m^2]
%Kp = 0; % Pump constant in [m^3/s/V]
Cd = 0.15; % Unitless discharge coefficient between 0 and 1
%vp = 0; % Pump voltage in [V]
%Kp calculation
X=(2*g*h);
b=sqrt(X);
Kp=((Cd*Ao*b)/(vp));
%Plot simulation Results
%% Simulate System
%sim_time = 120; % Length of simulation in [s]
%sim Sim_OpenLoop.mdl % Execute simulation
figure(1);
%ylim([1.0*10^-07 5.0*10^-07]) %set x-axis range
xlim([4 10]) % Set y-axis range
plot(vp,Kp);

回答 (1 件)

BOB MATHEW SYJI
BOB MATHEW SYJI 2020 年 9 月 15 日

1 投票

Replace Kp=((Cd*Ao*b)/(vp)); as
Kp=((Cd*Ao*b)./(vp));

4 件のコメント

BOB MATHEW SYJI
BOB MATHEW SYJI 2020 年 9 月 15 日
Since vp is a vector, we have to divide each element in it. So instead of using /vp use ./vp
Nataly Almasri
Nataly Almasri 2020 年 9 月 15 日
YAY!! that worked thank you so much!
BOB MATHEW SYJI
BOB MATHEW SYJI 2020 年 9 月 15 日
So, do you accept my answer??
John D'Errico
John D'Errico 2020 年 9 月 15 日
If this help you, then please accept the answer.

この質問は閉じられています。

タグ

質問済み:

2020 年 9 月 15 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by