Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have the following piece of code:

Plot[StateResponse[
   nss,
   {0.01 UnitStep[t - tstep], 0, 0, 0, 0}, {t, 0, tstop}] // Evaluate,
 {t, 0, tstop} ,
 PlotLabel -> "State Variable Open loop response to 1% step in Dd"]

which gives me a five variable plot.

I want to export this plot to excel to compare with some other data but can't get Export to format the exported Mathematica data as I want, i.e. in six columns.

Can anyone help on this?

share|improve this question
3  
Welcome to Mathematica! Hello dhog and welcome to the Mathematica StackExchange. It is always best to include a minimal, working example in your question. Users can then copy/paste/try your code and reproduce your problem. –  halirutan Dec 3 '12 at 15:58
    
I've a big matrices that needs to be plotted as part of the StateResponse command but I can't copy it in without loosing the Mathematica formatting, is it possible to enter it somehow? –  dhog Dec 3 '12 at 16:16
1  
is this Q/A relevant/useful? –  kguler Dec 3 '12 at 17:37

1 Answer 1

up vote 8 down vote accepted

If we define your parameters as:

 tstep = .5;
 tstop = 10;
 nss = StateSpaceModel[{
     {{0, 1, 0, 0}, {5.3572, 7.602, 56.6571,18.102}, 
      {0, 0, 0, 1}, {-5.3572, -7.602, -46.8571, -18.102}}, 
      {{0}, {0.5}, {0}, \{-0.5}}}, 
       SamplingPeriod -> None, SystemsModelLabels -> None];

Then store the response as a list:

 response = Table[Evaluate@StateResponse[nss, 
                    {0.01 UnitStep[t - tstep], 0, 0, 0, 0},
                    {t, 0, tstop}], {t, 0, tstop, .1}];
 ListPlot[Transpose@response,
          PlotLabel -> "State Variable Open loop response to 1% step in Dd", 
          Joined -> True]

enter image description here

Which can be exported to xls and plotted in Excel

 Export["temp.xls",response]

enter image description here

share|improve this answer
    
Thanks very much! This was exactly what I wanted! –  dhog Dec 3 '12 at 20:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.