15,965,166 members
1.00/5 (1 vote)
See more:

I want to implement a classical servo-like loop equation. For example, if
A is gain, then:
Af=A/(1-b*A), where Af is the resulting feedback gain, and B is beta, the sampled portion that must be updated to maintain a set point output of the loop's output. The loop could be a controller of room temperature.

What I have tried:

No attempt to code a feedback loop yet.
Posted
Updated 1-Apr-24 19:33pm
Amora Potter 26-Jun-24 4:36am
To implement a feedback loop in C that modifies an initial argument, you can follow the principles of a servo-like loop equation.
slope
tomhansky 3 days ago
What exactly does the servo-like loop equation principle look like? and how is it implemented? like as bob the robber

## Solution 1

We don't usually give people code if they haven't actually attempted anything yet. We will help you if you get stuck with your code, but we won't write it for you. What I will do, is offer you some guidance as to how to solve this. Write a function where you take gain and beta as arguments and check for invalid values: gain cannot be 0 or 1/beta (division by zero or infinite gain). Calculate the resulting feedback gain using the formula Af = gain / (1 - beta * gain). Return that value as your result. This is a simple function to write because you already know the formula. (Hint - use floating point numbers).

## Solution 2

Try some Learn C tutorial. Learn the basics before you start attempting to write some code.

Tip: learn to use the debugger.