Calculate multivariable equation with Matlab
2 次查看(过去 30 天)
显示 更早的评论
I am trying to calculate the voltage of a circuit with an ADC, the problem is that I am seeing that the voltage reading has to be done from a function and that it depends on the current of the circuit, I arrived at the following equations for 0A, 0.4 A and 1.1A:
0A: 0.10680454x - 7.6688459
0.4A: 0.10669344x - 13.84042838
1.1A: 0.10652463x - 24.9126498
How can I put this together into an equation with two variables One for the voltage reading and one for the amperage.
Thank you so much!
Here is a plot of how the amperaje affects the votlage reading
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1383174/image.jpeg)
0 个评论
回答(1 个)
Catalytic
2023-5-14
You need some sort of model for the line slopes and intercepts as a function of the amperage. There are infinitely many that can be proposed. For example -
x0=[0,0.4,1.1];
y0=[0.10680454 0.10680454 0.10652463;
7.6688459 13.84042838 24.9126498];
voltage=@(A,x) voltageFcn(A,x, x0,y0);
function v=voltageFcn(A,x, x0,y0)
p=spline(x0,y0,A);
v=p(1)*x+p(2);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sensors and Transducers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!