matlab-figure

How to get rid of the punctuation? and check the spelling error

守給你的承諾、 提交于 2019-12-11 23:53:51
问题 eliminate punctuation words split when meeting new line and space, then store in array check the text file got error or not with the function of checkSpelling.m file sum up the total number of error in that article no suggestion is assumed to be no error, then return -1 sum of error>20, return 1 sum of error<=20, return -1 I would like to check spelling error of certain paragraph, I face the problem to get rid of the punctuation. It may have problem to the other reason, it return me the error

Create a “counter” on matlab from 0:limit-1. The length of counter is not determined in the program

你说的曾经没有我的故事 提交于 2019-12-11 20:39:53
问题 Q- Create a "counter" from 0:limit-1 (for example if you choose 3 it will display 0,1,2). The length of counter is not determined in the program and it should be determined when it is being run and the inputs can differ from each other this is the solution on python but i want to compute it on matlab. how do i do that? for i in range(3): print(3-i) for s in range(3,-1,-1) print s so the answer is : 3 2 1 3 2 1 0 回答1: As Dan hinted you in the comments above, the colon operator of Matlab

Simple rotation of a rectangle along a curve in matlab

天大地大妈咪最大 提交于 2019-12-11 17:44:55
问题 I'm trying to rotate a rectangle(polyshape) in matlab to orient itself along the curve(a set of points). So far this is my code. l=2;w=1;xc=-1;yc=2; xvs= [xc+w/2 xc+w/2 xc-w/2 xc-w/2]; yvs= [yc-l/2 yc+l/2 yc+l/2 yc-l/2]; ax = gca; polyin = polyshape(xvs,yvs); % %w/2,h/2% polyin = rectangle('Position',[-0.1 -0.1 0.2, 0.4]); k=2; % t = acos((y(k-1)*x(k-1)+y(k)*x(k))/(norm([x(k-1) y(k-1)])*norm([x(k) y(k)]))); t = atan(y(k)/x(k)); polyout = translate(polyin,[-xc -yc]); polyout = translate

Datetick take into account NaN in plot

会有一股神秘感。 提交于 2019-12-11 17:34:39
问题 I have a series y that contains values, some of which are NaN some numeric (double). The series has an associated vector d which contains the datenum dates. Example: y=[NaN(5,1); rand(10,1)] d=now-14:now When I run: plot(d,y) I get the graph I want; the NaN observations are taken out. However, when I run: plot(d,y); datetick then my graph starts from the beginning and takes into account all the observations (even when y is a NaN ). How can I prevent this from happening? 回答1: From the

How to solve coupled differential equation in matlab using ode45

橙三吉。 提交于 2019-12-11 17:16:18
问题 I have two differential equations: da/dt=a(.3/a^3+.7)^1/2 and dτ/dt=1/a. The initial conditions are t=0; a=1 and τ=0, respectively. How can I solve the equations in Matlab? I need to calculate different values of a, t and τ also plot τ vs a. Thanks. 回答1: That's quite easy. First write a function to implement your differential equation and save it with a filename corresponding to the function name: function dy = my_ode(t,y) dy(1) = y(1)*(0.3/y(1)^3 + 0.)^(1/2); % a dy(2) = 1/dy(1); % tau Then

How to draw data file column with very small data difference using gnuplot

早过忘川 提交于 2019-12-11 16:23:59
问题 I have a data file with 7 columns in which I need to draw the first column versus 4th, 5th, 6th and 7th column. The data file looks like the following: 1.005146 1 2 0 0 0 0 1.006025 1 2 0 0 0 0 1.008025 1 2 0 0 0 0 1.010025 1 2 0 0 0 0 1.012025 1 2 0 0 0 0 1.014025 1 2 0 0 0 0 1.015146 1 2 0 0 0 0 1.016025 1 2 0 0 0 0 1.018025 1 2 0 0 0 0 1.020025 1 2 0 0 0 0 ...... when I try to plot the graph using the following command, I got only one point: plot "queuelength.txt" using 4 with linespoints

MATLAB:: Drawing a number on a image (Matrix) on MATLAB

我的梦境 提交于 2019-12-11 16:11:47
问题 I'm using matlab in order to perform modifications on an image. I have loaded an image on Matlab. (the image may be in different resolutions) Converted the image to gray scale then converted the image's matrix to double. I have drawn grid lines on the image (I have posted the code how to do that somewhere here on stack over flow). My problem is that I may have upon the 1000 squares as a result from girding the image on the X axis and the Y axis. I'd like to numbering the squares in that image

MATLAB: Plotting only ponts with colorbar based on another variable

廉价感情. 提交于 2019-12-11 15:16:02
问题 I want to plot only data points. Now I can plot the points which only considers 1 type of point. But my data contains different column variables. I want to plot different figures with different x and y variables from the data. Suppose I want to plot variable D against variable A or variable E against variable year but I want to plot data points with different colors or different types of points either *, dot, diamond etc. based on suppose, variable pub or variable E . Now for colormap I want

Too many input arguments to uicontrol callback

人走茶凉 提交于 2019-12-11 15:03:36
问题 I am trying to write a scroll bar that changes the x-range of many subplots at the same time. kids = get(gcf,'Children'); h=uicontrol('style','slider',... 'units','normalized','position',Newpos,... 'callback',{@slide_axes,kids},'min',0,'max',xmax-chunkDuration); Update_axes is defined in the same file: function slide_axes(h) set(h,'xlim',get(gcbo,'value')+[0 20000]); end However, I get the error: ??? Error using plot_scroll>slide_axes Too many input arguments. ??? Error while evaluating

Conversion to unit8 data class in MATLAB

£可爱£侵袭症+ 提交于 2019-12-11 14:54:00
问题 I am new to matlab in beginner phase. I want to know that How to convert a (2*3) matrix having values out side the range [0 255] to an uint8? I am trying to convert it to unit8 data class but it gives me the following error with the following syntax. B=unit8(A). where A is 2*3 Matrix values [4 5 6 ; 2 4 5] error: Undefined function 'unit8' for input arguments of type 'double'. 回答1: It is spelling Mistake. it is uint8 not unit8 来源: https://stackoverflow.com/questions/19180466/conversion-to