"step" Function Help
3 views (last 30 days)
Show older comments
I am trying to plot a step response with the "step" function. I am getting a plot, but it is not what I expected. My step response jumps up and stays flat, rather than oscillating as expected.
What am I doing wrong, and how can I change my code so it looks like the second picture I posted?? Thanks!
Code:
clear
clc
kp=10;
kd=.3;
j1=1*10^(-3);
j2=2*10^(-4);
b=5.82*10^(-3);
k=5;
num1=[j2 b k];
den1=[j1*j2 (j1+j2)*b (j1+j2)*k 0 0];
g1=tf(num1,den1);
num2=[b k];
den2=[j1*j2 (j1+j2)*b (j1+j2)*k 0 0];
g2=tf(num2,den2);
num3=[kd kp];
den3=1;
c=tf(num3,den3);
t2=g2*c/(1+g1*c);
step(t2)
1 Comment
Matt Kindig
on 21 May 2013
Your code gives me the desired (oscillating) image. Maybe add a 'close all' at the top of your script?
Answers (0)
See Also
Categories
Find more on Plot Customization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!