curve

add a curve that fits the peaks from a plot in R?

无人久伴 提交于 2019-12-01 01:54:41
Is there a function that adds a curve that fits the peaks if given two vectors and their plot? For example, I have: x= c(0:20) x [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 y [1] 19.4 17.9 8.1 11.3 7.8 8.0 5.0 1.7 3.9 5.4 7.5 5.4 4.7 5.0 4.9 3.5 2.9 2.4 1.4 1.7 plot(x,y,xlim=range(x),ylim=range(y)) best, Nanami Mathematically speaking, your problem is very poorly defined. You supply a range of discrete values, not a function, for your y values. This means it can not be differentiated to find local maxima. That said, here is a bit of code that might get you started. It makes use of

Fitting binned lognormal data in Python

≡放荡痞女 提交于 2019-12-01 01:17:05
I have a range of particle size distribution data arranged by percentage volume fraction, like so:; size % 6.68 0.05 9.92 1.15 etc. I need to fit this data to a lognormal distribution, which I planned to do using python's stats.lognorm.fit function, but this seems to expect the input as an array of variates rather than binned data, judging by what I've read . I was planning to use a for loop to iterate through the data and .extend each size entry to a placeholder array the required number of times to create an array with a list of variates that corresponds to the binned data. This seems really

Playing perfect Tetris: how to align and scale two curves using scaling and translation?

天大地大妈咪最大 提交于 2019-11-30 18:56:54
Given parameters of scaling on the y axis (s) and translation on the x axis (t), how to scale and align two curves that do not coincide when the purpose is to maximize curve superposition (not minimize distance)? As indicated by @DWin, this could be rebranded "How to play Tetris perfectly with R", though it does have applications far beyond winning a Tetris game. A variation of this question could involve any number of rigid body transformations (rotation, translation and scaling). Given curve 1 curve1<-data.frame(x=c(1,1,2,2,3), y=c(9,6,6,3,3)) with(curve1, plot(x=x, y=y, type="l", xlim=c(0

Matlab, how to calculate AUC (Area Under Curve)?

谁说我不能喝 提交于 2019-11-30 14:08:51
问题 I have the file data.txt with two columns and N rows, something like this: 0.009943796 0.4667975 0.009795735 0.46777886 0.009623984 0.46897832 0.009564759 0.46941447 0.009546991 0.4703958 0.009428543 0.47224948 0.009375241 0.47475737 0.009298249 0.4767201 [...] Every couple of values in the file correspond to one point coordinates (x,y). If plotted, this points generate a curve. I would like to calculate the area under curve (AUC) of this curve. So I load the data: data = load("data.txt"); X

Closing a contour curve in OpenCV

*爱你&永不变心* 提交于 2019-11-30 12:22:40
I'm using OpenCV (Canny + findCountours) to find external contours of objects. The curve drawn is typically almost, but not entirely, closed. I'd like to close it - to find the region it bounds. How do I do this? Things considered: Dilation - the examples I've seen show this after Canny, although it would seem to me it makes more sense to do this after findContours Convex hull - might work, though I'm really trying to complete a curve Shape simplification - related, but not exactly what I want Using PolyLine method to draw contours cv2.PolyLine(img, points, is_closed=True, 255, thickness=1,

Matlab, how to calculate AUC (Area Under Curve)?

落花浮王杯 提交于 2019-11-30 09:50:18
I have the file data.txt with two columns and N rows, something like this: 0.009943796 0.4667975 0.009795735 0.46777886 0.009623984 0.46897832 0.009564759 0.46941447 0.009546991 0.4703958 0.009428543 0.47224948 0.009375241 0.47475737 0.009298249 0.4767201 [...] Every couple of values in the file correspond to one point coordinates (x,y). If plotted, this points generate a curve. I would like to calculate the area under curve (AUC) of this curve. So I load the data: data = load("data.txt"); X = data(:,1); Y = data(:,2); So, X contains all the x coordinates of the points, and Y all the y

Playing perfect Tetris: how to align and scale two curves using scaling and translation?

允我心安 提交于 2019-11-30 02:41:44
问题 Given parameters of scaling on the y axis (s) and translation on the x axis (t), how to scale and align two curves that do not coincide when the purpose is to maximize curve superposition (not minimize distance)? As indicated by @DWin, this could be rebranded "How to play Tetris perfectly with R", though it does have applications far beyond winning a Tetris game. A variation of this question could involve any number of rigid body transformations (rotation, translation and scaling). Given

How to create 2d plot of arbitrary, coplanar 3d curve

醉酒当歌 提交于 2019-11-29 17:29:55
I have a set of points which comprise a (in theory) co-planar curve. My problem is that the plane is arbitrary and can move between each time I collect the data (these points are being collected from a camera). I was wondering if you guys could help me figure out how to: find the plane which is closest to the one which these points are co-planar on project the points on this plane in such a way that gives me a 2-d curve I believe that I know how to do point 2, it is really mainly point 1 that i'm struggling with, but I wouldn't mind help on the second point as well. Thanks a ton! find 3 points

Curving an image that starts as a rectangle (uploaded by user), preferably using Canvas or JS

坚强是说给别人听的谎言 提交于 2019-11-29 15:51:39
I'm trying to create a site that curves an image uploaded by a user, and then allows the user to save the new image. I'm having trouble figuring out how to curve the image as shown in the link below. I can create the curved shape as a solid color in Canvas, but not with an image. http://i53.tinypic.com/2gule04.jpg I tried something like this. I have a source image having width 300 and height 227. And I am going to bend this image 15 pixel down. So create a canvas with same width and height = imageWidth + 15 px. ie. 227+15 = 242. HTML: <img id="source" src="rhino.jpg"> <canvas id="canvas" width

Closing a contour curve in OpenCV

余生长醉 提交于 2019-11-29 13:30:00
问题 I'm using OpenCV (Canny + findCountours) to find external contours of objects. The curve drawn is typically almost, but not entirely, closed. I'd like to close it - to find the region it bounds. How do I do this? Things considered: Dilation - the examples I've seen show this after Canny, although it would seem to me it makes more sense to do this after findContours Convex hull - might work, though I'm really trying to complete a curve Shape simplification - related, but not exactly what I