similar to: Fit a sine to data

Displaying 20 results from an estimated 10000 matches similar to: "Fit a sine to data"

2010 Dec 20
2
Sine Regression in R
Hi everyone, I am trying to fit a sine function on one year of wind data. I have two questions below. Looking around on the net I managed to get the following: Sine Equation: y = a + b * sin( c + d*x ) b is the amplitude, c is the phase shift, d is something deal with periodicty of data*.* This can be linearised by sin( c+dx ) = cos(c) * sin(dx) + sin(c) * cos(dx). If one calls dx = x1 y
2008 Jun 10
3
fitting periodic 'sine wave' model
I have been attempting to estimate the periodic contribution of an effect to some data but have not been able to fit a sine wave within R. It would be nice to start by being able to fit a sine wave with an amplitude and frequency. x<-seq(0,20,by=0.5) y<-2*sin(2*pi*.5*x) #amplitude =2, frequency=0.5 # This failed to converge r<-nls(y ~ A*sin(2*pi*F*x), start=list(A = 1, F = 1),
2010 Oct 18
2
Sine function fitting
Hi, Is there a package to perform a sine function fitting to XY data? Thx, Ashz -- View this message in context: http://r.789695.n4.nabble.com/Sine-function-fitting-tp3000156p3000156.html Sent from the R help mailing list archive at Nabble.com.
2011 Aug 05
1
Translate Sine Function in R?
Hello, I'm trying to generate a sine wave in R to fit my observations using the general formula: y=a*sin(b[x+h*pi)]+k where a = amplitude, b=period, h=phase shift, and k=vertical shift I want to use following translation to bring the sine function up onto the y-axis to range from 0-1, and this will place the wave on the x-axis from 0-pi/2. y=1/2sin(2[x+ 1/4*pi]) + 1/2 Additionally, I need
2010 Feb 01
1
Fwd: Re: Fixed Point on wideband-mode: Single Frame loss on 2000 Hz sine causes "freak off"
Hi Jean-Marc, my answers: see below. Any good ideas how I should proceed? Jean-Marc Valin <jean-marc.valin at usherbrooke.ca> hat am 1. Februar 2010 um 13:09 geschrieben: > Hi Frank, > > On 2010-02-01 05:56, Frank Lorenz wrote: > > I get really strange results when comparing floating and fixed point > > versions of interal variables of the ltp, so either something is
2008 Jul 10
4
Turn any vector
Dear R-users, I'd like to turn a vector so it starts with it's end. For better understanding, this set of commands will do what I need: i <- seq(1:10) i_turned <- i for (j in 1:length(i)) i_turned[j] <- i[length(i)-j+1] now, i_turned is what I call turned. Is there a function which would make a script lighter? Thank you upfront for any hint. Best regards, Zroutik
2008 Nov 20
4
Fitting a sine wave using solver
Greetings, I have several sets of oscillation data and would like to estimate the parameters of a sine function to each set (and hopefully automate this). A colleague provided an excel sheet that uses solver to minimize the RSS after fitting the sine function to each data set, but this cumbersome and difficult to automate. Is there a method in R for fitting a given sine function to a
2017 Jun 21
2
fitting cosine curve
What I did was to plot your initial values, then plot the smoothed values and guess the constants. That is, I got an "eyeball" fit to the smoothed values. As I have described this as "gross cheating" in the past, you should either split your data, estimate on one subset and then test on another, or estimate on your data and test on a replication. If you get pretty much the same
2006 Feb 20
2
Write pure sine to *.ogg directly?
Hello, I am author of a Morse code training software written in Perl at http://starling.ws/morse Currently I output to *.wav and, if on Unix, convert to *.ogg. And that's okay for a trainer. But I have desire to upgrade the project to a real-time communication tool...or at least a Morse code audio mail routine. And I should like to avoid *.wav. I'd like some means of writing a pure
2011 Jul 27
2
fitting sine wave
Dear R-helpers ? I have 7 data points that I want to fit a continuous curve to, that should look similar to a sine wave My data points would mark the local minima and maxima respectively. This is what I?ve got so far. And I would keep doing so, but sadly nls() then says that it has reached the maximum number of Iterations? ?
2008 Sep 07
1
Echo cancelling results
Hi, I wanted to play around with the echo canceller so I tried the testecho program. As speaker sound I fed it with a 440 Hz sine wave, and as mic with a 550 Hz + 440 Hz sine waves sound (but the 440 Hz component half the amplitude). I kind of expected to get a somewhat clean 550 Hz sine out, but it doesn't seem to work that way. Are there better samples I can use with testecho to see
2000 Aug 31
2
More information on exception
The following block of code produces an exception. The testnew.ogg file is 10 seconds, containing pure silence encoded using mode E: http://www.cs.mun.ca/~chris3/testnew.ogg Other files and modes can cause the exception, but many files work fine. #include <stdio.h> #include "vorbis/vorbisfile.h" int main() { OggVorbis_File ov, ov2; FILE *f, *f2; f
2006 Oct 11
1
during fitting of successive datasets, stall crashes iterations
Hi all, I am trying to do fitting of large sets of timeseries data, and error messages derail the process when I encounter a dataset that doesn't fit. I'd like to ignore those "misfits" and try another equation or move to the next dataset. Any ideas? (piece of code below) Thanks, --Warren ##The code looks something like this: attach(zf) x <- hours
2008 Jul 14
1
creating axis of the plot before data are plotted
Dear R-users, I'm tackling with a problem which causing me a head-ache for a long time. I would like to create a nice x-axis to my plots, but I do not know how to implement the method. Imagine a matrix where you have rownames real numbers -- these rownames should be written in the x-axis nicely. I could not find any way how. I'll describe what I'm doing now: I have a matrix where
2017 Jun 21
1
fitting cosine curve
If you know the period and want to fit phase and amplitude, this is equivalent to fitting a * sin + b * cos > >>> > I don't know how to set the approximate starting values. I'm not sure what you meant by that, but I suspect it's related to phase and amplitude. > >>> > Besides, does the method work for sine curve as well? sin is the same as cos with
2006 Dec 19
2
fit sine?
Hello list, I am making scatterplots of data that vary sinusoidally over 24 hours. With a bit of previous help from this list, I now can get an x-axis with time tics from 00:00 on the left edge to 12:00 in the middle and 00:00 on the right edge, i.e., just 24 hours. Now I would like to fit a sin function to the plot. I've looked all over CRAN and the web in general, but have not found a
2008 Aug 14
1
the name of the current running script.r
Dear R users, is there a hack how to get the filename of the current script.r sourced/ran? My issue: I have a couple of scripts which were optimised and are placed in tens of directories. (I have a height.r script in 30 directories, a lines.r script in 25 directories and another flow.r script in 54 directories, growing). The script runs in the directory and does its job: sources data and creates
2008 Jan 10
3
Cycle Regression Analysis in R?
Hello R community, Does anyone know of a package that will perform cycle regression analysis? I have searched the R-help archives etc. but have come up with nothing so far. If I am unable to find an existing R package to do so, is there anyone familiar with fitting sine functions to data. My problem is this: I have a long time-series of daily SWE estimates (SWE = snow water equivalence, or
2017 Jun 21
0
fitting cosine curve
I'm trying the different parameters, but don't know what the error is: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Thanks for any suggestions. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen <don-r-help at isis.cs3-inc.com> wrote: > > If you know the period and want to fit phase and amplitude, this is > equivalent to
2010 Jun 17
3
trigonometric regression
Suppose I do a trigonometric regression fit<-lm(y~ cf + sf) where cf and sf are the cos and sine components. b<-coef(fit) I have the fitted sine component b[2] and the cos component b[3]. Doing summary(fit) gives me the p-values and SEs for b[2] and b[3]. But I want the amplitude of the fitted waveform amp<-sqrt(b[2]^2+b[3]^2) Can someone please tell me how to get the p-value for amp?