fitlm and exponential model help
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dharmesh Joshi
el 4 de Oct. de 2022
Respondida: Star Strider
el 5 de Oct. de 2022
Hi
I have a set of data, which is voltage from a sensor aganist temperture.
As temperture increase the voltage output from the sensor will drop, even though the sensing enviroment in the same.
Therefore i need to be able to calulate the correction factor so the output is very close to when sensor is expose to 20 degrees.
I am using fitlm, but when i use exponential i am getting errors, which is not then when i use Quadratic
This is what i am using
no2Model = fitlm(iot_temperature, voltage_differnce_no2, "exponential");
Is this the correct command to use?
1 comentario
Respuesta aceptada
Star Strider
el 5 de Oct. de 2022
Example —
t = linspace(0, 10, 25);
y = 3*exp(-0.25*t) + 0.5*randn(size(t)) + 1;
fcn = @(b,x) b(1).*exp(b(2).*x) + b(3);
B0 = randn(3,1);
mdl = fitnlm(t,y,fcn,B0)
[yfit,yci] = predict(mdl,t(:));
figure
hp{1} = plot(t, y, '.', 'DisplayName','Data');
hold on
hp{2} = plot(t, yfit, '-r', 'DisplayName','Model Fit');
hp{3} = plot(t, yci, ':r', 'DisplayName','±95% CI');
hold off
grid
xlabel('t')
ylabel('y')
legend([hp{1},hp{2},hp{3}(1)], 'Location','best')
.
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!