Effacer les filtres
Effacer les filtres

How to calculate values at the nodal points?

3 vues (au cours des 30 derniers jours)
revathy M
revathy M le 27 Sep 2017
Réponse apportée : AM le 26 Mar 2020
hi!
Need to evaluate certain values at every nodal point. Have discretized then have used for loop to do calculation. Not getting any error but there is a variation in the result. My need is the value of P1,P2 ..... etc must be evaluated at each point. Do x_bar(j) represent the value of x_bar at the j th position (like x_bar(1)=0,x_bar(1)=0.01etc).
Xb = [0, .5, 1.25, 1.50];
delx_bar = [.01, .005, .0001];
x_bar = cumsum([Xb(1), repelem(delx_bar,diff(Xb)./delx_bar)]);
del_eta=0.02;
eta_inf=4;
n_xbar=length(x_bar);
eta=(0:del_eta:eta_inf).';
n_eta=length(eta);
for j=2:n_xbar-1
for i=2:n_eta
P1(j) = 1 - cos(x_bar(j));
P2(j) = 1 + cos(x_bar(j));
end
end
  2 commentaires
Walter Roberson
Walter Roberson le 27 Sep 2017
What is the purpose of your "for i=2:n_eta" loop? You do not use "i" inside the loop.
revathy M
revathy M le 30 Sep 2017
Have just given the part of the code.i runs over the row and j runs over the column.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 28 Sep 2017
Xb = [0, .5, 1.25, 1.50];
delx_bar = [.01, .005, .0001];
x_bar = cumsum([Xb(1), repelem(delx_bar,diff(Xb)./delx_bar)]);
del_eta=0.02;
eta_inf=4;
n_xbar=length(x_bar);
eta=(0:del_eta:eta_inf).';
n_eta=length(eta);
P1 = zeros([],[]) ;
P2 = zeros([],[]) ;
for j=2:n_xbar-1
for i=2:n_eta
P1(i,j) = 1 - cos(x_bar(j));
P2(i,j) = 1 + cos(x_bar(j));
end
end

Plus de réponses (1)

AM
AM le 26 Mar 2020
Hi, I need a help for my diploma work, can anyone help me to write my matlab code, it's so important.

Catégories

En savoir plus sur Clocks and Timers 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