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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by