Calculate multivariable equation with Matlab

4 ビュー (過去 30 日間)
Daniel
Daniel 2023 年 5 月 14 日
回答済み: Catalytic 2023 年 5 月 14 日
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

回答 (1 件)

Catalytic
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

カテゴリ

Help Center および File ExchangeSensors and Transducers についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by