Dear all,
I'm quite new in octave env and this is the first post for me. Basically I have this issue. I've designed a new sensor where, unlikely, a temperature change makes a change in reading. Of course I need to compensate this unwanted behavior. I did some tests to make this table that is the error in measurement in [°/°C] Angle ° 5°C 25°C 50°C 181.10 0.0184 0.0000 -0.0167 219.56 0.0041 0.0000 -0.0010 263.90 -0.0153 0.0000 0.0193 5.45 -0.0151 0.0000 0.0173 48.17 0.0028 0.0000 -0.0042 77.03 0.0141 0.0000 -0.0179 124.98 0.0229 0.0000 -0.0252 165.05 0.0155 0.0000 -0.0275 Now I need to make the surface trend function and to implement it in firmware in order to compensate the wrong value. Usually the temperature effect is just function of temperature, so a simple trend line (linear or polynomial) Not in this case where the error is temperature and angle function, so a surface function. What I ask you is a method to get the function in octave (commands and so on). Thanks in advance -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
On 01/05/2018 10:43 AM, alessio31183
wrote:
It's a nice exercise showing Octave's practical usefulness. First, you want to see the data and display it:I've designed a new sensor where, unlikely, a temperature change makes a change in reading. Of course I need to compensate this unwanted behavior. I did some tests to make this table that is the error in measurement in [°/°C] Angle ° 5°C 25°C 50°C 181.10 0.0184 0.0000 -0.0167 219.56 0.0041 0.0000 -0.0010 263.90 -0.0153 0.0000 0.0193 5.45 -0.0151 0.0000 0.0173 48.17 0.0028 0.0000 -0.0042 77.03 0.0141 0.0000 -0.0179 124.98 0.0229 0.0000 -0.0252 165.05 0.0155 0.0000 -0.0275 a=sortrows([ So, if you had a model for the error, you could fit it here, but since you don't mention anything, we'll eyeball it. The error surface is almost-but-not-quite linear in temperature, but there is a strange kink in the error between 150 and 200 deg at T=5, so the question is how accurate is your error data? I think it's +-10% so a reasonable error approximation could be .025*sin((ang-40).*pi./180).*(1-(temp-5)/22.5) hold off; mesh(ang,temp,a(:,2:end)'); hold on ; mesh(ang,temp,arrayfun(@(ang,temp) .025*sin((ang-40).*pi./180).*(1-(temp-5)/22.5),ang,temp))If you get better error data, you could start fitting this (or some other) ad-hoc 2-d function to your data, using e.g. leasqr() from the optim package. _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
Free forum by Nabble | Edit this page |