Plotting 2D line variable categories
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Zakaria OUAOUJA
il 9 Giu 2023
Risposto: Subhajyoti Halder
il 21 Giu 2023
I've run two simulations (Base and Novel models), each one has 3 outputs, and I want to plot the results in two categories as shown below. I've done this manually.
Thank you.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1407179/image.jpeg)
4 Commenti
Rik
il 10 Giu 2023
How exactly did you add it manually? Why can't you put the code you used in a script (or function)?
Risposta accettata
Subhajyoti Halder
il 21 Giu 2023
Hello Zakaria,
It is my understanding that it is required to plot the output of two simulations which are having three outputs.
Please find the below example implementation:
t = linspace(200, 0, 100)
% dummy output of base-model
base_model = log(sort(40*rand(100,3)))
% dummy output of novel-model
novel_model = log(sort(40*rand(100,3)))
yyaxis left
plot(t,base_model,Color='b')
ylabel('base model')
yyaxis right
plot(t,novel_model,Color='r')
ylabel('novel model')
title('Temperature at various depth (Base model vs co-sim Twalk-in = -20*C')
xlabel('time')
legend('Center','Top Surface','Bottom Surface')
In this example, it is plotting the values of both the models in the same plot, with their axes on either vertical side, while the common time-axis at the bottom.
For more details on the plot function, kindly go through the following documentation link -
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots 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!