getting errors while trying to plot

1 vue (au cours des 30 derniers jours)
Cesar Cardenas
Cesar Cardenas le 29 Mar 2023
I'm trying to plot this but I'm getting errors. Not sure how to fix them. Any help will be greatly appreciated. Thanks much.
% Toggle display for troubleshooting
% disp(['Calculating Streamwise Position ' ...
% num2str(LCVx) ' of ' num2str(Nx) ' (x = ' ...
% num2str(x(LCVx)) ' m)'])
% Solve for u at the next x location
% ENTER CODE HERE %
n=LCVx-1;
u_ns(1)=0;
u_ns(M)=Ue(n+1);
for mi =2:M-1
Q=nu*delta_x/u(mi)/delta_y^2;
P=1/2*delta_x/delta_y*v(mi)/u(mi);
u_ns(mi) = u(mi)+Ue(n)/u(mi)*(Ue(n+1)-Ue(n))+...
Q*(u(mi+1)-2*u(mi)+u(mi-1))-...
P*(u(mi+1)-u(mi-1));
end
% Solve for v at the next x location using the continuity equation
% ENTER CODE HERE %
v_ns(1)=0;
for mi =2:M
P=1/2*delta_y/delta_x;
v_ns(mi) = v_ns(mi-1)- ...
P*(u_ns(mi)-u(mi)+u_ns(mi-1)-u(mi-1));
end
% Update velocity profiles
u = u_ns;
v = v_ns;
% Calculate momentum thickness
% ENTER CODE HERE %
uf = @(z)interp1(y,u,z);
thetafun = @(z)uf(z).*(1-uf(z));
theta(LCVx) = integral(thetafun,min(y),max(y));
% Calculate skin friction coefficient
% ENTER CODE HERE %
cf(LCVx) =((nu/dy)/Uef (xstart)^2)*(4*u(2)-u(3));
if mod(n,500)==0
figure;subplot(1,2,1);plot(y,u_ns);subplot(1,2,2);plot(y,v_ns);
pause;
end
end uplots = u./Ue; yplots = y./theta; for x = xstart:0.2:xend figure hold on plot(y,u) figure hold on plot(yplots,uplots)
end
  5 commentaires
Cris LaPierre
Cris LaPierre le 29 Mar 2023
Attach your text files to your post using the paperclip icon, and then we can say for certain.
Cesar Cardenas
Cesar Cardenas le 29 Mar 2023
Thanks for your reply. Enclosed the txt files.

Connectez-vous pour commenter.

Réponses (1)

Mathieu NOE
Mathieu NOE le 29 Mar 2023
Déplacé(e) : Fangjun Jiang le 29 Mar 2023
the error message is quite clear
Unable to find file or directory 'negm_profiles.txt'.
this file is not in your directory
double check by typing in your command window
dir *.txt
if you need more help , it's genrally a good thing to share your data files along the code
  1 commentaire
Mathieu NOE
Mathieu NOE le 29 Mar 2023
Déplacé(e) : Fangjun Jiang le 29 Mar 2023
your code works fine with the provided txt files.
the next problem is here , here arrays size are not matching
uplots = u./Ue;
yplots = y./theta;
u and y are 300x1 arrays while Ue and theta are 8001x1 arrays
which one is the good size and how will you modify the code accordingly ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by