Invalid Array Indexing when trying to plot the function

3 Ansichten (letzte 30 Tage)
Baldwin Chen
Baldwin Chen am 25 Nov. 2022
Verschoben: Jan am 25 Nov. 2022
% 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.

Antworten (1)

Dyuman Joshi
Dyuman Joshi am 25 Nov. 2022
Verschoben: Jan am 25 Nov. 2022
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.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by