MATLAB Answers

How to create a table using fprintf, and use data from a for loop that uses stepinfo?

16 views (last 30 days)
Robert  Flores
Robert Flores on 18 Oct 2018
Edited: Robert Flores on 18 Oct 2018
Hello, I am trying to make a table using the fprintf function. I am using data from a for loop that I have created show below in the code. Also, the data comes from another function stepinfo. I want to have the columns named: K=1 K=10 K=30 K=50, and the rows equal to the same titles that stepinfo outputs in the command window. If you are able to help it will be most appreciated!

  1 Comment

Robert  Flores
Robert Flores on 18 Oct 2018
I don't know why my code is displaying weird, but here it is in this comment.
clc, clear, close all
num = {1};
den = {[1 7 10 0]};
Gs = tf(num,den)
output = step(Gs);
for k = [1 10 30 50] % Values from question 3
num1 = {k};
den1 = {[1 7 10 k]};
Gcl = tf(num1,den1)
output1 = step(Gcl);
INFO = stepinfo(Gcl)
hold on
fprintf(1, 'K=1 K=10 K=30 K=50')
fprintf(1, 'DATA', INFO')

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!