Converting from hours to seconds on Simbiology
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Rebeca Hannah Oliveira
 il 9 Gen 2023
  
    
    
    
    
    Commentato: Rebeca Hannah Oliveira
 il 9 Gen 2023
            Does the Simbiology Model Analyzer have a simple way of converting data plots from seconds to hours? 
Like, if I were writing the code on Matlab, I would just divide the time for 3600 and run the simulation to make this conversion (t = t/3600), so I was wondering if that is also something that I can do directly on simbiology ?
Eg: 
h=3600;
plot(time/h,simulation(:,1))
0 Commenti
Risposta accettata
  Jeremy Huard
    
 il 9 Gen 2023
        Hi Rebeca,
plots in SimBiology Model Analyzer will use the time unit specified in the program's simulation stop time.
So, if you convert the StopTime currently in seconds to the equivalent in hours and rerun the program, the plots will use hours instead.
For this to work, please make sure that unit conversion is turned on in the Simulation settings.
Best regards,
Jérémy
3 Commenti
  Jeremy Huard
    
 il 9 Gen 2023
				Hi Rebeca,
that's right. Unit conversion requires you to define units for all components in your model.
If you can, I would recommend to do so to allow you to use different units in your model while ensuring the system of units is consistent and be able to change the stop time's unit. SimBiology will also perform  volume scaling automatically.
If you can't, the easiest way would be to export the simulation results to the MATLAB workspace and write some code to create the plot using steps similar to the following ones:
1- export results from Model Analyzer

2- extract quantity you want to plot, e.g.:
[t, x] = selectbyname(results, "Central.Drug");
3- create a plot
plot(t/3600, x, DisplayName="Central.Drug");
I hope this helps.
Best regards,
Jérémy
Più risposte (0)
Community
Più risposte nel SimBiology Community
Vedere anche
Categorie
				Scopri di più su Extend Modeling Environment in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!