math

How to remove frequency from signal

白昼怎懂夜的黑 提交于 2020-12-30 14:33:43
问题 I want to remove one frequency (one peak) from signal and plot my function without it. After fft I found frequency and amplitude and I am not sure what I need to do now. For example I want to remove my highest peak (marked with red dot on plot). import numpy as np import matplotlib.pyplot as plt # create data N = 4097 T = 100.0 t = np.linspace(-T/2,T/2,N) f = np.sin(50.0 * 2.0*np.pi*t) + 0.5*np.sin(80.0 * 2.0*np.pi*t) #plot function plt.plot(t,f,'r') plt.show() # perform FT and multiply by dt

How to find an inverse of a nearly singular matrix?

此生再无相见时 提交于 2020-12-30 02:12:06
问题 I am realizing an algorithm using C++ and CUDA. But I got into trouble when I tried to find an inverse of a special matrix. This matrix has following features: it is a square matrix (suppose: (m+3)x(m+3),m>0); its transpose matrix is its self; its main diagonal must be zeros; it must have a 3x3 zero matrix on the bottom right corner; you can consider this matrix in this form:H = [A ,B ;B' ,0]; I have tried some methods but all failed: pseudo-inverse matrix: I used matlab at first and got

How to find an inverse of a nearly singular matrix?

陌路散爱 提交于 2020-12-30 02:11:59
问题 I am realizing an algorithm using C++ and CUDA. But I got into trouble when I tried to find an inverse of a special matrix. This matrix has following features: it is a square matrix (suppose: (m+3)x(m+3),m>0); its transpose matrix is its self; its main diagonal must be zeros; it must have a 3x3 zero matrix on the bottom right corner; you can consider this matrix in this form:H = [A ,B ;B' ,0]; I have tried some methods but all failed: pseudo-inverse matrix: I used matlab at first and got

How to find and print intersections of n given circles in O(n*log(n)) time?

心不动则不痛 提交于 2020-12-29 06:45:06
问题 I'm looking for an O(n*logn) algorithm to find and print the intersections of n given circles. Each circle is specified by its center and radius. An O(n 2 ) algorithm consists in checking if the distance between the centers is less than or equal to the sum of the radii (of the two circles being compared). However, I'm looking for a faster one! A similar problem is intersection of line segments. I think even my problem can be solved using line sweep algorithm, but I am unable to figure out how

Detect if a set of points in an array that are the vertices of a complex polygon were defined in a clockwise or counterclockwise order?

做~自己de王妃 提交于 2020-12-29 02:49:28
问题 EDIT: I updated the program with the answer and it works great! I am making a program (feel free to try it out) that lets users draw polygons which it then triangulates. They can click to add vertices and hit enter to triangulate. Anyways, the algorithm works fine as long as I tell it if the points were drawn in a clockwise or counterclockwise fashion (right now I have it set only to work with clockwise polygons). I have been trying to figure this out for days, but have no idea how to

How do I effectively calculate zoom scale?

谁都会走 提交于 2020-12-28 09:57:19
问题 I have a draggeable image contained within a box. You can zoom in and zoom out on the image in the box which will make the image larger or smaller but the box size remains the same. The box's height and width will vary as the browser is resized. The top and left values for the image will change as it is dragged around. I'm trying to keep whatever the point the box was centered on in the image, in the center. Kind of like how zoom on Google Maps works or the zoom on Mac OS X zooms. What I'm

Get all pixel coordinates between 2 points

十年热恋 提交于 2020-12-28 07:46:55
问题 I want to get all the x,y coordinates between 2 given points, on a straight line. While this seems like such an easy task, I can't seem to get my head around it. So, for example: Point 1: (10,5) Point 2: (15,90) 回答1: Edit: The solution below only applies from a geometrical point of view. Drawing on a screen is different than theoretical geometry, you should listen to the people suggesting Bresenham's algorithm. Given, two points, and knowing that the line's equation is y = m*x + b , where m

Get all pixel coordinates between 2 points

懵懂的女人 提交于 2020-12-28 07:46:13
问题 I want to get all the x,y coordinates between 2 given points, on a straight line. While this seems like such an easy task, I can't seem to get my head around it. So, for example: Point 1: (10,5) Point 2: (15,90) 回答1: Edit: The solution below only applies from a geometrical point of view. Drawing on a screen is different than theoretical geometry, you should listen to the people suggesting Bresenham's algorithm. Given, two points, and knowing that the line's equation is y = m*x + b , where m

Get all pixel coordinates between 2 points

不羁岁月 提交于 2020-12-28 07:44:25
问题 I want to get all the x,y coordinates between 2 given points, on a straight line. While this seems like such an easy task, I can't seem to get my head around it. So, for example: Point 1: (10,5) Point 2: (15,90) 回答1: Edit: The solution below only applies from a geometrical point of view. Drawing on a screen is different than theoretical geometry, you should listen to the people suggesting Bresenham's algorithm. Given, two points, and knowing that the line's equation is y = m*x + b , where m

Mapping A Sphere To A Cube

僤鯓⒐⒋嵵緔 提交于 2020-12-27 07:58:39
问题 There is a special way of mapping a cube to a sphere described here: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html It is not your basic "normalize the point and you're done" approach and gives a much more evenly spaced mapping. I've tried to do the inverse of the mapping going from sphere coords to cube coords and have been unable to come up the working equations. It's a rather complex system of equations with lots of square roots. Any math geniuses want to take a crack