필터 지우기
필터 지우기

How to calculate values at the nodal points?

조회 수: 3 (최근 30일)
revathy M
revathy M 2017년 9월 27일
답변: AM 2020년 3월 26일
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
Walter Roberson
Walter Roberson 2017년 9월 27일
What is the purpose of your "for i=2:n_eta" loop? You do not use "i" inside the loop.
revathy M
revathy M 2017년 9월 30일
Have just given the part of the code.i runs over the row and j runs over the column.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 9월 28일
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

추가 답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Clocks and Timers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by