Plotting a matrix / Plotear una matriz

2 views (last 30 days)
Alex CB
Alex CB on 14 Oct 2019
Answered: Alex CB on 24 Oct 2019
Hello everyone.
I'm a student and I have to use Matlab for a certain practice, in this practice we are given certain functions/scripts, one of them show several plots that change over time inside a single figure (I think that is subplotting, right?) and can also return a matrix that correlates with that plot. The figure is divided in a 5x5 space.
The ""general" point of the practice is to be able to slightly change thier program so other types of system appear instead of the this ones,nothing too complex but I wanted to try going a step further.
I would want to introduce that matrix as a "subplot" of that figure, is that possible?
The closest I got was with "prueba_plot" (it "plots" the matrix, is not in order, but that is not that important, I can try to put it well later)
The matrix I want to introduce as a plot is A04 in "Vision_TCD_SCARA_4_GDL_mov.m"
It's needed to execute RI_SetPath since there are some funcionts that are called from the other folders.
Sorry that the explanations in the programs are in spanish and for my possible bad grammar.
Thanks in advance to everyone.
Buenas a todos.
Hace unos días me enviaron unas prácticas que consisten en modificar ligeremente unos programas dados para que al "plotearlos" muestren unos sistemas parecido a los que hay actualmente (creo que eso de mostrar varios plots en una figura es con subplot, ¿verdad?). Este sistema va variando y estos cambios se muestran en el plot. Además estos scripts contienen una matriz que también hay que mostrar y está relacionada con este sistema ploteado.
He estado buscando formas de introducir la matriz en la figura como un subplot pero no he encontrado nada que me valga, lo más cerca es "prueba_plot".
La matriz a plotear sería A04 del script "Vision_TCD_SCARA_4_GDL_mov.m"
Para que fucnione es necesario ejecutar RI_SetPath pues estos script llaman a funciones en otras carpetas.
Muchas gracias por adelantado a todos.

Accepted Answer

Kaashyap Pappu
Kaashyap Pappu on 21 Oct 2019
I am assuming you are trying to have multiple axes on a single figure window, where a few of the subplots will be used to plot matrix data.
If you want to plot data onto multiple axes within the same figure window, the function ‘subplot’ could help. Using the plot function, a matrix can be plotted however each column is treated as an individual line. If you want to plot multiple data sets within the same set of axes, the hold on command allows overlaying plots on top of one another.
Hope this helps!

More Answers (1)

Alex CB
Alex CB on 24 Oct 2019
Thanks for the quick answer, fortunately I was able to discover how to show it in the subplot as I wanted.
It is something like this, but due to the computer I am using right now, the matrix won't show correctly.
Again, thanks a lot!

Community Treasure Hunt

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

Start Hunting!