Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

What is wrong with this code?

1 Ansicht (letzte 30 Tage)
jake carl
jake carl am 10 Jul. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
clear all;
n1=1;n2=25; den=[1 6 25];
figure
step=[n1,den];
title('Transfer function when numerator = 1')
figure
impulse=[n2,den];
title('Standard transfer function')
  2 Kommentare
Image Analyst
Image Analyst am 11 Jul. 2020
jake, what happened to your question?
Rena Berman
Rena Berman am 22 Jul. 2020
(Answers Dev) Restored edit

Antworten (1)

Les Beckham
Les Beckham am 10 Jul. 2020
If you are trying to plot the step and impulse responses of your transfer function you need to call step() and impulse() as functions instead of assigning values to them as variables.
I think it is now recommended to create a transfer function object rather than using the (num, den) arguments to step() and impulse(),
So, try this (I don't currently have the control system toolbox so I can't test this, but I think it should work).
n1 = 1;
n2 = 25;
den = [1 6 25];
figure
sys1 = tf(n1, den);
step(sys1);
title('Transfer function when numerator = 1')
figure
sys2 = tf(n2, den);
impulse(sys2);
title('Standard transfer function')
  2 Kommentare
jake carl
jake carl am 10 Jul. 2020
Error in Untitled42 (line 5)
sys1 = tf(n1, den);
The same problem more than once
Les Beckham
Les Beckham am 11 Jul. 2020
Do you have the control system toolbox? Please post the entire error message (everything in red).

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by