Need gradual data values.

This is the data values I got for my equation. It is not smooth curve. If the data values are gradual, the curve is smooth. Generally, Where I rectify to get gradual values?
0.0320415867172945
0.184398415806668
0.0330722761271637
0.00593158809660344
0.00106384384348042
0.000190802817875919
3.42209202342026e-05
6.13760003501216e-06
1.10079255414445e-06
1.97429653341276e-07
3.54094582777690e-08
6.35076704185715e-09
1.13902454263924e-09
2.04286647610229e-10
3.66392758273023e-11
6.57133762217517e-12
1.17858437890949e-12
2.11381794403936e-13
3.79118065749105e-14
6.79956891191319e-15
1.21951818087333e-15
2.18723365076115e-16
3.92285340067338e-17
7.03572697769140e-18
1.26187366818545e-18
2.26319918255593e-19
4.05909931323577e-20
7.28008712697735e-21
1.30570021786759e-21
2.34180309823753e-22
4.20007722742912e-23
7.53293422903285e-24
1.35104892187110e-24
2.42313703238507e-25
4.34595149195947e-26
7.79456304700777e-27
1.39797264663868e-27
2.50729580216841e-28
4.49689216358189e-29
8.06527858156800e-30
1.44652609473487e-30
2.59437751788373e-31
4.65307520534857e-32
8.34539642645792e-33
1.49676586861698e-33
2.68448369732820e-34
4.81468269174236e-35
8.63524313641209e-36
1.54875053662087e-36
2.77771938414703e-37
4.98190302093494e-38
8.93515660784508e-39
1.60254070123860e-39
2.87419327029082e-40
5.15493113441686e-41
9.24548647276300e-42
1.65819906976727e-42
2.97401782272611e-43
5.33396874425575e-44
9.56659450635627e-45
1.71579052741179e-45
3.07730941454665e-46
5.51922456824746e-47
9.89885504874850e-48
1.77538221292648e-48
3.18418846063841e-49
5.71091457323429e-50
1.02426554413933e-50
1.83704359688380e-51
3.29477955805639e-52
5.90926222687402e-53
1.05983964786276e-53
1.90084656265939e-54
3.40921163115544e-55
6.11449875137923e-56
1.09664924972184e-56
1.96686338438106e-57
3.52750066766359e-58
6.32031682314549e-59
1.09823600535655e-59
Thanks for advance.

2 commentaires

Torsten
Torsten le 12 Juin 2023
Evaluate your equation for more points in between x=1 and x=3 (or whatever the independent variable for your equation is).
Nathi
Nathi le 13 Juin 2023
clc; close all; clear all;
ymax=20; m=80; dy=ymax/m; %y=dy:dy:ymax; %'i'th row
xmax=1; n=20; dx=xmax/n; %'j'th column
tmax=100; nt=500; dt=tmax/nt; t=0:dt:tmax;
UOLD=zeros(m,nt); VOLD=zeros(m,nt);
TNEW=0; TOLD=TNEW*ones(m,nt); TWALL=ones(1,length(t));
A=zeros([1,m]);
B=A;
C=A;
D=A;
T=TOLD;
tic
for j=1:nt
for i=1:m
if j>i
C(i)=(dt*VOLD(i,j)/4*dy)-(dt/(2*dy^2));
elseif i>j
A(i)=(-dt*VOLD(i,j)/4*dy)-(dt/(2*dy^2));
elseif i==j
B(i)=1+(dt*UOLD(i,j)/2*dx)+(dt/(dy^2));
end
end
end
for j=2:nt
if j==1
for i=2:m-1
if i==2
D(i)=(-dt*UOLD(i,j)*(-TNEW+TOLD(i,j)-TNEW)/2*dx)+(dt/(2*dy^2)*(TWALL(j)-2*TOLD(i,j)+TOLD(i-1,j)))-(dt*VOLD(i,j)/4*dy*(TOLD(i-1,j)-TWALL(j)+TOLD(i,j)))-(-dt/4*dy*VOLD(i,j))-(dt/2*dy^2*TWALL);
elseif i==m-1
D(i)=(-dt*UOLD(i,j)*(-TNEW+TOLD(i,j)-TNEW)/2*dx)+(dt/(2*dy^2)*(TOLD(i+1,j)-2*TOLD(i,j)+TNEW))-(dt*VOLD(i,j)/4*dy*(TNEW-TOLD(i+1,j)-TOLD(i,j)))-(dt/4*dy*VOLD(i,j))-(dt/2*dy^2*TNEW);
else
D(i)=(-dt*UOLD(i,j)*(-TNEW+TOLD(i,j)-TNEW)/2*dx)+(dt/(2*dy^2)*(TOLD(i+1,j)-2*TOLD(i,j)+TOLD(i-1,j)))-(dt*VOLD(i,j)/4*dy*(TOLD(i-1,j)-TOLD(i+1,j)+TOLD(i,j)));
end
end
else
for i=2:m-1
if i==2
D(i)=(-dt*UOLD(i,j)*(-T(i,j-1)+TOLD(i,j)-TOLD(i,j-1))/2*dx)+(dt/(2*dy^2)*(TWALL(j)-2*TOLD(i,j)+TOLD(i-1,j)))-(dt*VOLD(i,j)/4*dy*(TOLD(i-1,j)-TWALL(j)+TOLD(i,j)))-(-dt/4*dy*VOLD(i,j))-(dt/2*dy^2*TWALL(j));
elseif i==m-1
D(i)=(-dt*UOLD(i,j)*(-T(i,j-1)+TOLD(i,j)-TOLD(i,j-1))/2*dx)+(dt/(2*dy^2)*(TOLD(i+1,j)-2*TOLD(i,j)+TNEW))-(dt*VOLD(i,j)/4*dy*(TNEW-TOLD(i+1,j)+TOLD(i,j)))-(dt/4*dy*VOLD(i,j))-(dt/2*dy^2*TNEW);
else
D(i)=(-dt*UOLD(i,j)*(-T(i,j-1)+TOLD(i,j)-TOLD(i,j-1))/2*dx)+(dt/(2*dy^2)*(TOLD(i+1,j)-2*TOLD(i,j)+TOLD(i-1,j)))-(dt*VOLD(i,j)/4*dy*(TOLD(i-1,j)-TOLD(i+1,j)+TOLD(i,j)));
end
end
end
T(:,j)=TriDiag(A,B,C,D);
dt=0.2+dt;
TOLD=T;
end
@Torsten As you said to evaluate the first three points in x(i.e., I'm taking i =1:m) only the matters now. but i couldn't identity the position in my equation and how to rectify the first three points to obtain gradual values ?.
eventhough, I'm using iteration for better smooth curve, but the first three points only stuck in my case.
please resolve my issue. thank you

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 12 Juin 2023
Modifié(e) : John D'Errico le 12 Juin 2023
Actually, it IS quite a smooth curve. Almost perfectly smooth, in fact.
y = [0.0320415867172945
0.184398415806668
0.0330722761271637
0.00593158809660344
0.00106384384348042
0.000190802817875919
3.42209202342026e-05
6.13760003501216e-06
1.10079255414445e-06
1.97429653341276e-07
3.54094582777690e-08
6.35076704185715e-09
1.13902454263924e-09
2.04286647610229e-10
3.66392758273023e-11
6.57133762217517e-12
1.17858437890949e-12
2.11381794403936e-13
3.79118065749105e-14
6.79956891191319e-15
1.21951818087333e-15
2.18723365076115e-16
3.92285340067338e-17
7.03572697769140e-18
1.26187366818545e-18
2.26319918255593e-19
4.05909931323577e-20
7.28008712697735e-21
1.30570021786759e-21
2.34180309823753e-22
4.20007722742912e-23
7.53293422903285e-24
1.35104892187110e-24
2.42313703238507e-25
4.34595149195947e-26
7.79456304700777e-27
1.39797264663868e-27
2.50729580216841e-28
4.49689216358189e-29
8.06527858156800e-30
1.44652609473487e-30
2.59437751788373e-31
4.65307520534857e-32
8.34539642645792e-33
1.49676586861698e-33
2.68448369732820e-34
4.81468269174236e-35
8.63524313641209e-36
1.54875053662087e-36
2.77771938414703e-37
4.98190302093494e-38
8.93515660784508e-39
1.60254070123860e-39
2.87419327029082e-40
5.15493113441686e-41
9.24548647276300e-42
1.65819906976727e-42
2.97401782272611e-43
5.33396874425575e-44
9.56659450635627e-45
1.71579052741179e-45
3.07730941454665e-46
5.51922456824746e-47
9.89885504874850e-48
1.77538221292648e-48
3.18418846063841e-49
5.71091457323429e-50
1.02426554413933e-50
1.83704359688380e-51
3.29477955805639e-52
5.90926222687402e-53
1.05983964786276e-53
1.90084656265939e-54
3.40921163115544e-55
6.11449875137923e-56
1.09664924972184e-56
1.96686338438106e-57
3.52750066766359e-58
6.32031682314549e-59
1.09823600535655e-59];
x = 0:numel(y)-1;
semilogy(x,y,'o')
So only the very first point is at all in error. I would note that the first data point seems to be in error. But we can fix that. We can see the problem in another way from here:
diff(log(y))
ans = 79×1
1.7501 -1.7184 -1.7184 -1.7184 -1.7184 -1.7184 -1.7184 -1.7184 -1.7184 -1.7184
And that plot suggests there is no need at all to smooth the curve. Ok, if you prefer, the first data point is just a bit off. We can use a simple straight line fit against log(y) to correct the first point.
P1 = polyfit(x(2:end),log(y(2:end)),1)
P1 = 1×2
-1.7184 0.0286
So the very first data point SHOULD have been approximately:
exp(P1(2))
ans = 1.0290
semilogy(x,y,'bo',0,exp(P1(2)),'rs')
grid on
You should see that the red square now appears to be perfectly in line with the rest of the curve.
Again, all that was needed was to look at your curve in the correct way.

1 commentaire

Nathi
Nathi le 13 Juin 2023
@John D'Errico You exactly got my point. Yes, it's first three points only error and it's only not gradually increasing and decreasing and all other points are perfectly fit well. I'm using this technique and it's not quite acceptable.
For example,
1 1.7813 2.339 2.6461 2.7189 2.603 2.3574 2.0404 1.7003 1.371 1.0761 0.8234 0.6161 0.4516 0.3248 0.2294 0.1592 0.1087 0.0731 0.0483 0.0315 0.0202 0.0128 0.008 0.0049 0.003 0.0018 0.001 0.0006 0.0003 0.0002 0.0001 0.0001
Please plot this data. the curve comes well. but the above one edges are sharp. but i don't want the sharp edges. it should be gradual values like this data.

Connectez-vous pour commenter.

Catégories

Question posée :

le 12 Juin 2023

Commenté :

le 13 Juin 2023

Community Treasure Hunt

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

Start Hunting!

Translated by