# How to draw or create a tangent for step response so I can take the value of A to tune PID?

**URL:** <https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271>\
**Category:** PLECS\
**Tags:** scope, pid\
**Created:** [February 8, 2018, 5:39am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271 "2018-02-08T05:39:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EMdude](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@EMdude](https://forum.plexim.com/u/EMdude)\
**Post date:** [February 8, 2018, 5:39am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271/1 "2018-02-08T05:39:19Z")

</div>

hello,

I want to calculate the parameters of PI controller, I need the tangent of the step response, can you please tell me how to do it.

cheers

---

<div class="post-metadata">

**Author:** ![Niklaus\_Felderer](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/niklaus_felderer/32/6_2.png) [@Niklaus\_Felderer](https://forum.plexim.com/u/Niklaus_Felderer)\
**Post date:** [February 13, 2018, 3:27am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271/2 "2018-02-13T03:27:10Z")

</div>

Hi,

You can use the PLECS scope to do this. Either place the cursors close to the beginning of the step response and calculate the slope or, if you assume an exponential step response, place the second cursor at ≈63% of the final value and read off the time constant directly. (Like in the attached picture)

I hope this helps you.  
Best regards,  
NF

 ![cursors.png](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/1X/044372dda9962eb3c59e6a1adcd701b5011e5c56.png)

---

<div class="post-metadata">

**Author:** ![EMdude](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@EMdude](https://forum.plexim.com/u/EMdude)\
**Post date:** [February 13, 2018, 9:53am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271/3 "2018-02-13T09:53:19Z")

</div>

hello NF,

thanks for your reply, what I want to have is the A which means I need to see the slope so I can estimate the A which we are using in the PI ziegler method tunig

I still dont get your point in using the cursor as whe I use the 2 cursor,they are both just calculating time

cheers

---

<div class="post-metadata">

**Author:** ![Niklaus\_Felderer](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/niklaus_felderer/32/6_2.png) [@Niklaus\_Felderer](https://forum.plexim.com/u/Niklaus_Felderer)\
**Post date:** [February 13, 2018, 10:12am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271/4 "2018-02-13T10:12:37Z")

</div>

Hi,

No, the cursors show the time but also the value of the displayed signal. To calculate the slope at a given point, place the two cursors t1 and t2 close together and read off the signal values u1 and u2 at both times t1 and t2. Then build the ratio:

slope = (u2-u1)/(t2-t1)

You might want to decrease the relative tolerance in the solver settings to get a better approximation of the slope.

For some operating systems (e.g. happens sometimes on Windows), you need to stretch the tab showing the signal values slightly to the right to effectively see the values. Like in the attached picture.

Best regards,NF

 ![cursors2.png](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/1X/29b436a8ffa8abfcb7ef5646fcb0da18fa4d8ec1.png)

---

<div class="post-metadata">

**Author:** ![EMdude](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@EMdude](https://forum.plexim.com/u/EMdude)\
**Post date:** [February 14, 2018, 9:05am UTC](https://forum.plexim.com/t/how-to-draw-or-create-a-tangent-for-step-response-so-i-can-take-the-value-of-a-to-tune-pid/271/5 "2018-02-14T09:05:27Z")

</div>

Hello,

Ok I have got your point now but as I want to measure the A which you can see in the image below I still cannot calculate or estimate the A

Cheers

 ![plecslope.PNG](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/1X/3ae4cd52e6375beb4f552598bdf1c7bd96c0ff85.png)
