Parse error at EDD

5 comentarios

Rono  Noah
Rono Noah el 17 de Nov. de 2020
Can someone help me please
Steven Lord
Steven Lord el 17 de Nov. de 2020
Without seeing the file this is going to be difficult if not impossible to answer. Please show us the section of heatConduction_Cline_2 around line 239, say lines 230 through 250 (or the end of the file, whichever comes first.) Also tell us if there are any Code Analyzer errors (red lines) or warnings (orange lines) in the Editor document window for that section of heatConduction_Cline_2. If there are, indicate which lines have those markers and what each marker says when you hover the mouse over the red and/or orange lines.
Rono  Noah
Rono Noah el 18 de Nov. de 2020
Editada: Rono Noah el 18 de Nov. de 2020
Thank you Steven for your response. Is it okay if I attach the whole code here? Or should I sent directly to you?
Steven Lord
Steven Lord el 18 de Nov. de 2020
Please post it here so everyone can see it and contribute to determining the cause of the error and how to correct it.
Rono  Noah
Rono Noah el 18 de Nov. de 2020
% calculate isotherm of temperature if 1
% define integration parameters
gu
UpLimit_miu = 300;
N_miu = 10;
miu = linspace(0, UpLimit_miu,N_miu*UpLimit_miu);
miu = miu + 0.01;
d_miu = miu(2)-miu(1);
% Initialize the integration matrix
Pe = 0:0.1:7;
L_Pe = length(Pe);
I_miu = zeros(L_Z, L_Pe);
%Sweep through Z
for m = 1:L_Z
for n = 1:L_Pe
H = (Pe(n)*miu.^2).^2./(1+miu.^2)/2+Z(m)^2./miu.^2/2;
y_miu = exp(-H)./(1+miu.^2)/sqrt(2*pi^3);
% y_miu = exp(-(X(n)+Pe(1)*miu).^2./(1+miu.^2)/2)./(1+miu.^2)/sqrt(2*pi^3);
I_miu(m,n) = sum(y_miu)*d_miu;
plot(Pe',I_miu);
drawnow;
end
end
xlabel('Pe')
ylabel('f')
legend('Z/R = 0', 'Z/R = 0.2', 'Z/R = 0.5', 'Z/R = 1')
end

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 18 de Nov. de 2020

0 votos

Let's look at one section of the snippet of code you posted.
for m = 1:L_Z
for n = 1:L_Pe
H = (Pe(n)*miu.^2).^2./(1+miu.^2)/2+Z(m)^2./miu.^2/2;
y_miu = exp(-H)./(1+miu.^2)/sqrt(2*pi^3);
% y_miu = exp(-(X(n)+Pe(1)*miu).^2./(1+miu.^2)/2)./(1+miu.^2)/sqrt(2*pi^3);
I_miu(m,n) = sum(y_miu)*d_miu;
plot(Pe',I_miu);
drawnow;
end
This end statement ends the for loop using the variable n.
end
This end statement ends the for loop using the variable m.
xlabel('Pe')
ylabel('f')
legend('Z/R = 0', 'Z/R = 0.2', 'Z/R = 0.5', 'Z/R = 1')
end
This end statement either ends something (another for loop, a while loop, a function statement) that began before the start of the snippet you posted or it isn't associated with another keyword. One way to tell which is which is to move the cursor over that end statement. If it is associated with something higher up in the code that should flash on the screen. If it doesn't it's likely a mismatched end.
I'd probably smart indent the code and make sure that each end is associate with the correct statement then remove the extra mismatched one. Which one you remove can make a difference. Consider the following:
function y = foo650718
y = 0;
for k = 1:5
for p = 1:7
y = y + 1;
end
y = y + 1;
end
y = y + 1;
end
end
There are three keywords that start a block to be ended by end: the function statement, the for over k, and the for over p. If you smart indent this (or look at the file in the Editor) there's one extra end statement. But which one you delete (or comment out) will affect the output of the function (except the last two; deleting either of those gives the same result.) Commenting out the first results in y = 75, the second in y = 45, and the third or fourth in y = 41. Smart indenting the code while different end statements are commented out will also show that the various "y = y + 1;" statements get included in different numbers of nested loops depending on which end is commented.

Categorías

Más información sobre Performance and Memory en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 17 de Nov. de 2020

Respondida:

el 18 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by