matlab-figure

No visible points for plot in for loop

依然范特西╮ 提交于 2021-02-17 06:19:37
问题 I'm struggling with a plot I want to make using a for-loop. I know it works when I add it after the loop (just a simple plot). But I want to try it in this other way. fib = ones(1:10); for k=3:10 hold on fib(k) = fib(k-1) + fib(k-2); plot(k,fib(k)) end hold off The output is a plot, but there are no points visible. 回答1: You need to specify a marker. The documentation says: If one of X or Y is a scalar and the other is either a scalar or a vector, then the plot function plots discrete points.

How to separate color errorbar matlab

五迷三道 提交于 2021-02-16 06:55:53
问题 Given the following example code: x = 0:pi/10:pi; y = sin(x); e = std(y)*ones(size(x)); figure errorbar(x,y,e) How are you able to color the line different compared to the horizontal lines? I tried errorbar(x,y,e,'--mo') But this changes all of them together... 回答1: Get a handle to the errorbar object. It has two children, corresponding to the data plot and error bars respectively. Then you can set the color of each separately. h = errorbar(x,y,e) %// a color spec here would affect both data

Use a slider in MATLAB GUI

南楼画角 提交于 2021-02-11 12:15:27
问题 Really simple question. I wish to create GUI with a simple plot that changes something with a slider. I have been using the GUI and have a slider+text on a panel and axies1. So for starters I just wish to have the slider going from 1:10 (no specific increments) and scaling the y-values (by 1:10). I have imported my data into the GUI, so leaving out the generic auto-generate code I have: Under Graphslide_OpeningFcn handles.OutAirTemp = OutAirTemp; handles.SupAirTemp = SupAirTemp; guidata

Plotting just the endpoint of quiver

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-11 06:16:49
问题 I need to plot a block of points with small deviations from their equilibrium states. Using quiver it would look like this: And now I want to plot just markers located on the arrow tips. How to do that? Input data are U and V deviations (on cartesian axes), getting the X,Y coordinates of vector origins is not a problem. 回答1: You can't simply use something like plot(X+U, Y+V, 'o') because quiver applies an automatically computed scale to U and V so that all arrows fit nicely in the figure. You

Plotting just the endpoint of quiver

旧城冷巷雨未停 提交于 2021-02-11 06:16:00
问题 I need to plot a block of points with small deviations from their equilibrium states. Using quiver it would look like this: And now I want to plot just markers located on the arrow tips. How to do that? Input data are U and V deviations (on cartesian axes), getting the X,Y coordinates of vector origins is not a problem. 回答1: You can't simply use something like plot(X+U, Y+V, 'o') because quiver applies an automatically computed scale to U and V so that all arrows fit nicely in the figure. You

Matlab dynamic legend / legend “hold on” like behavior

安稳与你 提交于 2021-02-07 09:41:20
问题 Just want to add more data do a legend without erasing it. Like a legend "hold on" Sample : plotData = array of plot data, like plotData(i) = plot(... N = size of plotData. Code : for i = 1:N str = sprintf('My plot y %d', i); %legendData(:,i) = [plotData; str]; %#ok<SAGROW> %[~,~,~,current_entries] = legend; %legend([current_entries [plotData; str]]); no sucess here % This command will erase the previous one. legend(plotData,str); end legend([plotX1,plotX2],'x 1','x 2'); I think I can store

Matlab dynamic legend / legend “hold on” like behavior

巧了我就是萌 提交于 2021-02-07 09:40:28
问题 Just want to add more data do a legend without erasing it. Like a legend "hold on" Sample : plotData = array of plot data, like plotData(i) = plot(... N = size of plotData. Code : for i = 1:N str = sprintf('My plot y %d', i); %legendData(:,i) = [plotData; str]; %#ok<SAGROW> %[~,~,~,current_entries] = legend; %legend([current_entries [plotData; str]]); no sucess here % This command will erase the previous one. legend(plotData,str); end legend([plotX1,plotX2],'x 1','x 2'); I think I can store

Matlab dynamic legend / legend “hold on” like behavior

强颜欢笑 提交于 2021-02-07 09:40:28
问题 Just want to add more data do a legend without erasing it. Like a legend "hold on" Sample : plotData = array of plot data, like plotData(i) = plot(... N = size of plotData. Code : for i = 1:N str = sprintf('My plot y %d', i); %legendData(:,i) = [plotData; str]; %#ok<SAGROW> %[~,~,~,current_entries] = legend; %legend([current_entries [plotData; str]]); no sucess here % This command will erase the previous one. legend(plotData,str); end legend([plotX1,plotX2],'x 1','x 2'); I think I can store

Generate bifurcation diagram for 2D system

柔情痞子 提交于 2021-02-07 03:30:39
问题 Drawing bifurcation diagram for 1D system is clear but if I have 2D system on the following form dx/dt=f(x,y,r), dy/dt=g(x,y,r) And I want to generate a bifurcation diagram in MATLAB for x versus r. What is the main idea to do that or any hints which could help me? 回答1: You first have to do some math: Setting each of the functions to zero gives you two functions y(x) (called the nullclines), which you can plot in a phase diagram. Where the two lines intersect are the fixed-points (equilibria)

Filling between two lines

不打扰是莪最后的温柔 提交于 2021-02-05 09:47:41
问题 I've plotted two lines based on some scattered points, however, I now need to fill the area between the two lines. counts_dataset = dataset('file','file.txt','Delimiter','\t'); x = counts_dataset.x; y1 = counts_dataset.y1; y2 = counts_dataset.y2; line1 = line(x, y1,'Color', [.8 .8 .8]) line2 = line(x, y2,'Color', [.8 .8 .8]) I am now trying to fill in the region between the two lines as so: fill([x fliplr(x)],[y2 fliplr(y1)],'c') However, this gives me this plot: disregard the scatter points