Strange function fit to data points- sorting by first column vals?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
does anyone have any idea why my function has such a strange shape? In the modelling app I'm not getting this.
I think I need to sort the T values keeping the rows together maybe but is there a way to keep columns together and sort by the first column vals?
conductivity4=abs(set4(:,2));
scatter(set4(:,1),conductivity4)
T4=set4(:,1);
hold on
y=(1.236*10^(-12))*exp(0.01189.*T4)
plot(T4,y)
ylim([1 2.2]*10^(-11))
xlim([180 240])
Thanks!
0 个评论
采纳的回答
Voss
2022-2-27
编辑:Voss
2022-2-27
I think it is the points not being in monotonic order in T4, and sorting them first will fix it, like you say.
% T4 values to use, in order:
T4_order = 180:240;
% create a random permutation of those values:
T4 = T4_order(randperm(numel(T4_order)));
% calculate the corresponding y values:
y=(1.236*10^(-12))*exp(0.01189.*T4);
% plot (should have the same problem as your plot):
figure();
plot(T4,y,'r');
% sort the T4:
T4 = sort(T4);
% calculate the corresponding y values:
y=(1.236*10^(-12))*exp(0.01189.*T4);
% plot (should be good):
figure();
plot(T4,y,'r');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!