matlab-figure

Animated plots MATLAB [closed]

怎甘沉沦 提交于 2019-12-04 06:50:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I have problem to produce animated plots, using MATLAB. I want to plot my signal y as a function of my time x (that i keep in two separate variables) and then produce an animation of it, seeing variations of my signal according to time. At the end, I would like to produce both a

How to create movies on each generation of a for loop in Matlab plot

…衆ロ難τιáo~ 提交于 2019-12-04 06:48:27
问题 I want to plot the sphere function as a surface or a contour plot, and the position and fitness value of the best individual which are evaluated by a sphere function of data generated from a Gaussian distribution superimposed with it. The plot will change in each generation so i get a movie. Also, on another figure, i want to plot the contour of the sphere function superimposed with the entire population generated from Gaussian distribution, with the retained fit individuals colored in red.

Animating a ball in Matlab

半城伤御伤魂 提交于 2019-12-04 06:25:16
问题 I have a ball with these two equations: x(t) = v0*cos(α)*t and y(t) = h + v0*sin(α)*t− 1/2 g t^2 , where t ∈ [0,t final] is the time variable, h is the height, v0 is the initial speed, α is the angle made by v0 with the horizontal, g = 9.8 m/s^2. The floor is at y(x) = 0. I need to draw a small animation of the ball moving on the plot. I now I should use for, plot, drawnow, but I don't know how to do it. Can you tell me how to obain this animation? 回答1: First, here are some test variables to

How to plot with specific colors the values of a matrix in matlab

天大地大妈咪最大 提交于 2019-12-04 05:35:50
问题 I am working in matlab and I have a matrix which I would like to visualize it by giving a green-ish color to the lowest values per column/row and red-ish to the rest or different levels of red-ish depending on how close or far this values is from the lowest one and lastly print the values within. For example lets say that I have the following matrix: 0.0085 0.0244 0.0335 0.0312 0.0392 0.0392 0.0246 0.0078 0.0234 0.0281 0.0395 0.0395 0.0299 0.0295 0.0108 0.0224 0.0598 0.0598 0.0253 0.0317 0

Plotting data with time series in matlab

回眸只為那壹抹淺笑 提交于 2019-12-04 05:26:24
问题 I have some data from 2007/5/1 to 2007/5/30 from 00:00 to 23:59:58. I want to plot these data according to data and time together. How can I define both date and time together? cause it has a regular date and time. For example 2007/5/1 00:00:00 -0.2 2007/5/1 00:00:02 -0.1 2007/5/1 00:00:04 -0.12 . . . 2007/5/31 23:59:58 -0.4 I've been used DateTime code but I have regular time interval and I don't know how to solve it. 回答1: Here is an example for using a datetime variable. You'll need to

Saving MATLAB figures as PDF with quality 300 DPI, centered

不打扰是莪最后的温柔 提交于 2019-12-04 03:49:13
I want to save a MATLAB figure as PDF, with quality 300 DPI , and centered. So far I managed to save it, but the image appears cropped. I changed the page type to A3 and kind of solves the problem, but I am looking for something more elegant. I am doing it from the GUI, but maybe from the command line is easier in MATLAB. Is there any package or script that makes this (fundamental task for publications and papers) a bit easier? Try using the following command: print -painters -dpdf -r300 test.pdf You will, of course, already have to have a file named test.pdf in the current directory. Some

Scaleable, draggable box on plots that can select data

纵然是瞬间 提交于 2019-12-04 03:39:39
Here's the setup: I've got a graphical plot of data, and I'm trying to find if it's feasible to try to put a box on the figure that can be moved and changed in width and return some values like percentage of and area under the curve. It looks something like this: Any suggestions on where to start? My feeling was that it might be doable using a more GUI'd interface versus a standard plot. Andrey Rubshtein I would start with imrect . It is draggable, and you can add callbacks to it. (Taken directly from MATLAB help) figure, imshow('cameraman.tif'); h = imrect(gca, [10 10 100 100]);

Making Particles Move Randomly Within A Circle [closed]

▼魔方 西西 提交于 2019-12-04 02:56:33
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . I am attempting to make plotted points move around within a circle of a known radius and center. At the moment I am able to generate points within the boundary, but now I need to make them move. I have the following script to generate the initial locations of the particles. function [particle_gen]

“Error using get” using a 'addlistener' function in Matlab GUI

纵饮孤独 提交于 2019-12-04 02:44:45
问题 I have a problem in a Matlab GUI code. Let say for instance that I want to display in the console the value of a slider cursor in the GUI. But the fact is that I want to display it in real time, eg at each position of the cursor even if the click is still on, while moving it. For this, I read on internet that the 'addlistener' function could help me. I put it in the slider_CreateFcn function like this : function slider1_CreateFcn(hObject, eventdata, handles) h=addlistener(hObject,'Value',

make filled shapes move in MATLAB

断了今生、忘了曾经 提交于 2019-12-03 23:07:03
问题 I have the following statement for drawing filled rectangler and cirle shapes in matlab. What I have to add for those statement only to make shapes between start point and target point for each without collision. fill([9.5 9.5 11.5 11.5 ],[12.6 14.6 14.6 12.6],'r'); %rectangler shape hold on r=1; color=[1 0 0]; t=linspace(0,2*pi); fill(15+r*cos(t),8+r*sin(t),color); %circle shape grid on 回答1: Example with a rectangle. The trick is to gradually modify the object properties, in this case its