Fit curve in a subplot
Mostrar comentarios más antiguos
I have a problem, if i want to fit a sin function over my data in different subplots. The sinefunction only plots one period.
If I plot the fuction without a subplot (in its own figure), the fit does work perfectly as shown.
Can sombody help me with a solution?
%% Basic approach for calibration of force sensors etc., Peter Poot
clear all
close all
clc
[rn1 rn2 rn3 n11 n12 n13 B]=dataverwerken_stijn1(2.25,0);
n2=6000;
for n=1:3
for m=2:54
B(:,m,n)= B(:,m,n)-mean(B(:,m,n));
end
end
%% test
% test the hack out of it
T1 = [n11 n12 n13];
figure
for n=1:1
for i=[5] %,10,17] %,24,28,32,36,40,44,48,52]
A=fit(B(T1(n):n2,1,n),B(T1(n):n2,i,n),'sin1')
subplot(3,1,n)
plot(A)
hold on
plot(B(T1(n):n2,1,n),B(T1(n):n2,i,n))
xlim([0 60])
end
end
figure
A=fit(B(T1(1):n2,1,1),B(T1(1):n2,5,1),'sin1')
plot(A)
hold on
plot(B(T1(n):n2,1,n),B(T1(n):n2,i,n))
xlim([0 60])
5 comentarios
wouter grolman
el 29 de Nov. de 2019
Swastik Sanjay Chaudhury
el 5 de Dic. de 2019
Hello wouter,
When I tried reproducing the issue on my end, I ran into the error :
"Undefined function or variable 'dataverwerken_stijn1'.
Error in Untitled5 (line 6)
[rn1 rn2 rn3 n11 n12 n13 B]=dataverwerken_stijn1(2.25,0);"
Looks like 'dataverwerken_stijn1' is a user defined function. It would help if you could provide the functon code for the same.
wouter grolman
el 6 de Dic. de 2019
Christopher Bennett
el 28 de Abr. de 2021
OP, what was the solution?
Adam Danz
el 28 de Abr. de 2021
My guess is that the use of hold on was freezing the axis limits.
Respuestas (0)
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
