Invalid Array Indexing when trying to plot the function
4 views (last 30 days)
Show older comments
% 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))
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.
0 Comments
Answers (1)
Dyuman Joshi
on 25 Nov 2022
Moved: Jan
on 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.
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!