Invalid Array Indexing when trying to plot the function

3 ビュー (過去 30 日間)
Baldwin Chen
Baldwin Chen 2022 年 11 月 25 日
移動済み: Jan 2022 年 11 月 25 日
% Empirical Constants
a = 0.0513
n = 0.4176
% Density
p = 0.9
% Initial Port Diameter
d_i = 1
% Initial raidus
r = 0.5
% Optimal 0/F Ratio
R = 4
% Mass Flow Rate
O = 20
% Burn Time
t = 5
%% Optimal Length versus Optimal O/F Ratio
Optimized_Length = ((O^(1-n))./(4^n*a*x*pi^(1-n)*p))*(d_i^(2*n+1)+2*a(2*n+1)(4*O./pi)^(n)*t)^((2*n-1)./(2*n+1))
Invalid array indexing.

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
Optimal_OF_Ratio = 1:0.01:10; %Range of the O/F rato we want to know the length of
plot(x,Optimized_Length,'Markersize',2','Color',[0 0.5 0])
xlabel('Optimal O/F Ratio','FontSize',10)
ylabel('Optimal Length','FontSize',10)
set(gca,'xtick', 1:0.5:10)
set(gca,'ytick', 1:2:100)
title('Time Averaged Relationship between Optimal Length','and Optimal O/F Ratio',FontSize=15)
For some reason, I can't seem to plot because of the problem and I don't know why this is occuring. Please help! Thank you.

回答 (1 件)

Dyuman Joshi
Dyuman Joshi 2022 年 11 月 25 日
移動済み: Jan 2022 年 11 月 25 日
You forgot operation signs in a few places
((O^(1-n))./(4^n*a*x*pi^(1-n)*p))*(d_i^(2*n+1)+2*a(2*n+1)(4*O./pi)^(n)*t)^((2*n-1)./(2*n+1))
% ^here ^here
I suggest you check the formula again, carefully.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by