Gaussian hypergeometric function 2F1(a,b;c;z)

Hi,
this is a somewhat specific question
I was very happy when I realized that the Advanced Analysis Library of CVI provides the Gaussian or ordinary hypergeometric function 2F1(a,b;c;z), GaussHG.
Unfortunately I have not been able to get the expected results, so I have to assume that I am doing something wrong and I would be grateful for assistance.
Here is the simple code trying to calculate the function
    for ( index = 0;
          index <= 1000;
          index ++ )
        x [ index ] = -10.0 + index * 0.0108;
        y_1 [ index ] = GaussHG ( x [ index ], 0.5, 2.0, 1.5 );
The first 833 elements of the y_1 array yield NaNs, the following numbers are oscillating in the range from +0.57 ... +3.29
Here is what I would have expected, using the online function plotter from Wolfram Research:
Help is very much appreciated!
Thanks,
Wolfgang
Solved!
Go to Solution.

Hi Wolfgang,
We have reported this issue as a bug. For a quick workaround, I suggest you take advantage of the following transform:
F(a,b,c,x) =  F(a, c - b, c, x/(x-1)) / (1-x)^a, which could map x from (-Inf, 0] to [0,1). 
You could revise the original code a bit if performance is not a concern:
for ( index = 0;index <= 1000;index ++ )
        x [ index ] = -10.0 + index * 0.0108;
        if(x[ index ]>=0)
              y_1 [ index ] = GaussHG ( x [ index ], 0.5, 2.0, 1.5 );
        else //use the transform to map negative x value to [0,1)
              y_1[ index ] = GaussHG ( x [ index ] / (x [ index ] - 1.0), 0.5, -0.5, 1.5 ) / pow(1.0-x [ index ], 0.5);
for ( index = 0;index <= 1000;index ++ )
        x [ index ] = -10.0 + index * 0.0108;
        if(x[ index ]>=0)
              y_1 [ index ] = GaussHG ( x [ index ], 0.5, 2.0, 1.5 );
        else //use the transform to map negative x value to [0,1)
              y_1[ index ] = GaussHG ( x [ index ] / (x [ index ] - 1.0), 0.5, -0.5, 1.5 ) / pow(1.0-x [ index ], 0.5);
Hope this workaround could help. Please feel free to let us know if you have any more questions, thanks!
Arthur

Similar Messages

  • Fitting a Gaussian curve onto a set of data

    I'm looking to plot a best fit Gaussian curve unto a set of data and was wondering if this is possible with just the labview 7 base development software. Any help would be greatly appreciated

    I assume you are trying to find a gaussian ditribution function to fit to the data. All you need is to find the average and the sample standard deviation of your data and then build the Gaussian function. You can plot that, you can also plot a histogram of your data to compare to the Gaussian plot.
    With little programming code, you should be able to do that.

  • Gaussian plot

    Hi!
    Need help to calculate FWHM (full width at half maximu) from sineformdata. I am using labview 7.1 so there is no gaussian fit function in that version. Please take a look at my code where my data is an array and waveform graph. Goal is to chage signal to look like gaussian and then calculate FWHM.
    Data included in vi
    Please help
    Attachments:
    Data.vi ‏22 KB

    I assume you are trying to find a gaussian ditribution function to fit to the data. All you need is to find the average and the sample standard deviation of your data and then build the Gaussian function. You can plot that, you can also plot a histogram of your data to compare to the Gaussian plot.
    With little programming code, you should be able to do that.

  • Gaussian Membership Curves in System Build FuzzyLogic block

    Hi,
    As noted in the SystemBuildTM FuzzyLogic Block User Guide (ver. Apr 2007), one can create a triangular membership curve by simply using the special function:
    TRG(x,a,b,c)
    Is there by any chance another special function to create a Gaussian membership curve (such a membership curve is very common in fuzzy control applications)? If not, any ideas on how I could define it myself, as I really need to use a Gaussian membership curve instead of a triangular one.
    Many thanks.
    Solved!
    Go to Solution.

    Ok, for those of you who might be interested in using a Gaussian membership function, I've just found a way to define it in the Fuzzy Logic block using the exp function, as follows:
    exp(-0.5*(X-c)^2/b^2)
    where
    c is the center of Gaussian function, and b^2 is the variance.

  • Private construtor, public static method

    Hi,
    I'm having a problem trying to use a class' method. The class' constructor is private, and the methods are public static....
    I created an object that belongs to the class, but then when I try to apply the methods to the object, the do not appear (qhen I write the period). Does anybody know why this happens...
    Thanks and regards

    Ok,
    I'll show you the code I'm trying to use. In case you want to see more from it, I downloaded it from http://info.synapse.ru/software/jpitsa/
    Just to give you a more clear idea, I unzipped the jar file which contained the code, and I got two classes with the same name on the same folder (one is a read-only file). The class I'm trying to use is called "Methods". The particular method I'm trying to use from that class is the one called hilbert, which does the Hilbert Transform (which is a Mathematical transformartion for signal processing).
    Thanks for your help. Here comes my code:
    * Spectral Analysis Module
    * @author Denis Mishin ([email protected])
    package jpitsa.core;
    import java.util.LinkedList;
    public final class Methods implements Params {
        private Methods() { }
         * Discrete Fourier Transform. <BR>
         * This method can be applied to data with any data points, not only a power of 2,
         * but works significantly slower then DFFT algorithm
         * @param source the data to transform
         * @param direct true if transform is direct, false for inverse
         * @param fullSpectrum  as fourier transform is symmetrical, it is possible to use only one part of it.\
         *      then the spectrum is created for 1/2 N points. reverse transform will work pretty well.
         * @see jpitsa.core.ComplexVector
        public static ComplexVector DFT (ComplexVector source, boolean direct) {
            ComplexVector result;
            float[] resIm, resRe;
            float[] srcIm, srcRe;
            float isign = (direct == true) ? 1f : -1f;
            srcIm = source.getDataImaginaryPart();
            srcRe = source.getDataRealPart();
            int N = srcIm.length;
            float mf = (direct == true) ? 1f : 1f/(float)N;
            resIm = new float[N];
            resRe = new float[N];
            double fac;
            double f1, fCos, fSin;
            f1 = isign*2*Math.PI/(float)N;
            for (int n=0; n < N/2; n++) {
                for (int k=0; k < (N-1); k++) {
                    fac = (float)(f1*(double)(k*n));
                    fCos = Math.cos(fac);
                    fSin = Math.sin(fac);
                    resRe[n] += srcRe[k]*fCos - srcIm[k]*fSin;
                    resIm[n] += srcRe[k]*fSin + srcIm[k]*fCos;
                resRe[n] *= mf;
                resIm[n] *= mf;
                resRe[N-1-n] = resRe[n];
                resIm[N-1-n] = resIm[n];
            return new ComplexVector(resRe, resIm);
         * This method computes Discrete Fast Fourier Transform from a given
         * complex array. Return type is also a complex array.
         * Objectives: only data of 2^n points can be processed. Thus providing number of aliasing effects.
         * @see jpitsa.core.ComplexVector
        public static ComplexVector DFFT (ComplexVector source, boolean direct) {
            ComplexVector   result;
            float[] data;
            int isign, ndat;
            isign = (direct == true) ? 1 : -1;
            data = source.getPackedData();
            ndat = (data.length-1)/2;
            four1 (data, ndat, isign);
            //System.out.println("ndat="+ndat);
            // too big values .... [mar-99]
            if(!direct) {
                for(int i=0; i < ndat*2-1; i++)
                    data[i] /= ndat;
            result = new ComplexVector();
            result.setPackedData(data);
            return result;
         * Computes a spectrum of TimeSeries
         * @return spectrum truncated to Nyquist frequency
        public static ComplexVector spectrum(TimeSeries source) {
          float sampfreq = source.getSamplingFrequency();
          ComplexVector spec = DFFT(new ComplexVector(source.getData(),null), true);
          float[] srcReal, srcImag, tgtReal, tgtImag;
          srcReal = spec.getDataRealPart();
          srcImag = spec.getDataImaginaryPart();
          tgtReal = new float[srcReal.length/2];
          tgtImag = new float[srcImag.length/2];
          System.arraycopy(srcReal, 0, tgtReal, 0, tgtReal.length);
          System.arraycopy(srcImag, 0, tgtImag, 0, tgtImag.length);
          return new ComplexVector(tgtReal, tgtImag);
         * Return given spectrum part of time series object
         * @param source source data
         * @param part defines which part of transform to extract (AMPLITUDE, PHASE, REAL, IMAGINARY)
         * @return spectrum (FrequencySeries) object
        public static FrequencySeries spectrum(TimeSeries source, int part) {
            ComplexVector spec = spectrum(source);
            float sPart[] = extractPart(spec, part);
            sPart[0] = sPart[1];
            return new FrequencySeries(sPart,source.getSamplingFrequency()/((float)(2*sPart.length)));
        public static FrequencySeries spectrum(TimeSeries source, int part, int smooth_win) {
            ComplexVector spec = spectrum(source);
            float sPart[] = extractPart(spec, part);
            sPart[0] = sPart[1];
            sPart = smooth(sPart, smooth_win);
            return new FrequencySeries(sPart, source.getSamplingFrequency()/((float)(2*sPart.length)));
    public static FrequencySeries power_spectrum(TimeSeries src)
        float tr_wrk[];              /* pntr to work trace                   */
        float tr_tap[];              /* pntr to taper                        */
        float tr_ans[];              /* pntr to answer                       */
    //    float *tr_src[];                /* pntr to source trace               */
        float t_samp;               /* sampling rate of trace               */
        float delta_f;          /* delta f of resulting power spec     */
        float wss;               /* window squared and summed          */
        float sumsq;          /* sum of the input trace squared     */
        float avesq;          /* ave of the input trace squared     */
        float pow_sum;          /* PSD Sum                    */
        int i1, i2;                 /* index of the zoom in spr_zoom        */
        int n1, n2, n3, n4;         /* taper window size                    */
        int i,j;                    /* loop vars                            */
        int index;                  /* index into data from cha_list        */
        int n_dat;                  /* size of trace                        */
        int done;                   /* tells us if we are done with io      */
        int io_res;                 /* result of an io operation            */
        int n_fft;                  /* number of points in fft window       */      
        int n_chk;                  /* temp to check that n_fft is pwr of 2 */
        int i_st;               /* start of window for fft          */
        int ask_each;               /* see if we ask for input each loop    */
        int io_taper;               /* taper method we are going to use     */
        boolean zero_pad;               /* true when we have to zero pad window */
        int sc_type;          /* type of scale ie lin-lin          */
        int selection_method;     /* selection used for zoom          */
        int status;               /* status of zoom               */
        int n;               /* number of fft's used for answer     */
          get the size of the trace
         float[] tr_src = src.getData();
         n_dat = tr_src.length;
         i1 = 0; i2 = tr_src.length-1;
         n_fft = next2power(n_dat); // check!!!!
         dt_copy_header(buffer[0],data[index]);
         dt_copy_header(buffer[1],data[index]);
         dt_copy_header(buffer[2],data[index]);
         dt_head_access(buffer[0],RCD_NDAT,(void *)&n_fft);
         dt_head_access(buffer[1],RCD_NDAT,(void *)&n_fft);
         n = n_fft/2 + 1;
    //     dt_head_access(buffer[2],RCD_NDAT,(void *)&n);
         tr_wrk = new float[n_fft+1];
         System.arraycopy(tr_src, 0, tr_wrk, 0, tr_src.length);
         tr_tap = new float[tr_wrk.length];
         System.arraycopy(tr_wrk, 0, tr_tap, 0, tr_wrk.length);
         //tr_wrk = dt_trace_access(buffer,0,    0);
         //tr_tap = dt_trace_access(buffer,1    ,0);
         //tr_tap = // taper_it
         tr_ans = new float[n];
         //tr_ans = dt_trace_access(buffer,2    ,0);
         //tr_src = dt_trace_access(data  ,index,0);
          calculate the mean squared amplitude
         sumsq = 0f;
         for (j=i1; j<i2; j++) {
             sumsq += tr_src[j] * tr_src[j];
         avesq = sumsq / (float)(n_dat);
          get the taper values.  Buffer 0 gets tapered even thought there is nothing there
         n1 = 0;
         n2 = n3 = n_fft/2 - 1;
         n4 = n_fft - 1;
         Taper.doTapering(tr_tap, n1, n2, n3, n4, n_fft, WELCH_WINDOW);
          init the result
         for (j=0; j<n_fft/2; j++) {
             tr_ans[j] = 0;
          calculate wss (window squared and summed)
         wss = 0f;
         for (j=0; j<n_fft; j++) {
             wss += tr_tap[j] * tr_tap[j];
         wss *= (float)n_fft;
          calculate fft's until we need to pad with zeros
         t_samp = src.getSamplingInterval();
         zero_pad = false;
         i_st = i1;
         n = 0;
         while (!zero_pad) {
              load work array and taper
             for (j=0; j<n_fft; j++) {
              if ((i_st + j) > i2) {
                  tr_wrk[j] = 0f;
                  zero_pad = true;
              } else {
                  tr_wrk[j] = tr_src[i_st+j] * tr_tap[j];
              calculate fft
             n++;
             realft(tr_wrk,n_fft/2,1);
              accum results
             tr_ans[0] += tr_wrk[0]*tr_wrk[0];
             for (j=2; j<n_fft; j+=2) {
              tr_ans[j/2] += 2.0 * (tr_wrk[j]*tr_wrk[j] + tr_wrk[j+1]*tr_wrk[j+1]);
             tr_ans[n_fft/2] += tr_wrk[1]*tr_wrk[1];
             i_st += n_fft/2;
          normalize
         for (j=0; j<=n_fft/2; j++) {
             tr_ans[j] /= ((float)n*wss);
          integrate result
         delta_f = t_samp*n_fft;
         pow_sum = tr_ans[0];
         for (j=1; j<n_fft/2; j++) {
             pow_sum += tr_ans[j];
         pow_sum += tr_ans[n_fft/2];
          convert to units^2/Hz
         for (j=0; j<n_fft/2; j++) {
             tr_ans[j] = tr_ans[j]/delta_f;
         //delta_f = (t_samp*n_fft);
        return new FrequencySeries(tr_ans, src.getSamplingFrequency()/ (float) tr_ans.length);
        //source.getSamplingFrequency()/((float)(2*sPart.length))
        public static FrequencySeries powspec1(TimeSeries src, int m) {
            float[] rawdata = src.getData();
            float[] res = PowSpec.spctrm(rawdata, m, rawdata.length/2, true);
            return new FrequencySeries(res, src.getSamplingFrequency()/2f);
         * returns coherence spectrum of two traces
         * result is a complex vector truncated to Nyquist frequency
        public static ComplexVector coherenceSpectrum (TimeSeries trace1, TimeSeries trace2) {
          if (trace1.getSamplingFrequency() != trace2.getSamplingFrequency())
            throw new IllegalArgumentException("Sampling freqs do not match");
          if (trace1.getDataLength() != trace2.getDataLength())
            throw new IllegalArgumentException("vectors length do not match");
          ComplexVector spec1, spec2, cohSpec;
          spec1 = spectrum(trace1);
          spec2 = spectrum(trace2);
          return (ComplexVector)spec1.mul(spec2.conjugate());
         * returns a given part of coherence spectrum of two traces
        public static FrequencySeries coherenceSpectrum (TimeSeries trace1, TimeSeries trace2, int part) {
          float[] res = extractPart(coherenceSpectrum(trace1,trace2), part);
          return new FrequencySeries(res, trace1.getSamplingFrequency()/(float)(2*res.length));
         * XCorellation of two vectors
         * @param v1 first vector
         * @param v2 second vector
        public static Vector1D corellation(Vector1D v1, Vector1D v2) {
          if (v1.getDataLength() != v2.getDataLength())
            throw new IllegalArgumentException("vectors length do not match");
          ComplexVector sp1, sp2, res;
          sp1 = DFFT(new ComplexVector(v1.getData(),null), true);
          sp2 = DFFT(new ComplexVector(v2.getData(),null), true);
          res = DFFT((ComplexVector)sp1.mul(sp2.conjugate()), false);
          float[] data = res.getDataAmplitudePart();
          float[] data2 = new float[data.length/2];
          System.arraycopy(data,0, data2, 0, data2.length); data2[0] = data2[1];     
          return new Vector1D(data2);
         * Computes a sonogram for a trace
         * This is an optimized algorithm,
        public static Matrix sonogram(TimeSeries data, float stepSec, float window, int taperType, float taperFraction) {
          LinkedList frq = new LinkedList();
          float sampling = data.getSamplingFrequency();
          int step = Math.round(sampling*stepSec);
          DataWindow currentWindow = data.getWindow();
          data.setMessagesAllowed(false);
          DataWindow win = new DataWindow();
          win.startOffset = currentWindow.startOffset;
          win.length      = Math.round(window*sampling);
          boolean computing = true;
          float[] tgt = null;
          int leng = 0;
          if (step < 1)
            step = 1;
          System.err.println("COMPUTING SONOGRAM: step="+stepSec+" ("+step+") length="+window+" ("+win.length+")");
          while (computing) {
            data.setWindow(win);
            ComplexVector spec;
            float[] src = taper(data, taperFraction, taperType).getTotalData();
            spec = DFFT(new ComplexVector(src,null), DIRECT);
            leng = spec.getDataPointsNumber() / 2;
            tgt = new float[leng];
            spec.getDataAmplitudePart(tgt);
            src = extractPart(spec, AMPLITUDE, tgt);
            tgt = new float[ftlen];
            System.arraycopy(src,0,tgt,0,tgt.length);
            tgt = src;
            // --- THIS CODE SHOULD BE REMOVED
            for (int i=0; i < tgt.length; i++)
                tgt[i] = (tgt[i] > 0) ? (float)Math.log(tgt) : tgt[i];
    //tgt = smooth(tgt, Math.round(.05f*tgt.length));
    // --- THIS CODE SHOULD BE REMOVED
    //System.err.println("Step: "+win.startOffset+":"+win.length);
    frq.add(tgt);
    win.startOffset += step;
    if (win.getEnd() > currentWindow.getEnd())
    computing = false;
    data.setWindow(currentWindow);
    data.setMessagesAllowed(true);
    Matrix m;
    m = new Matrix(frq.size(), leng);
    for (int i=0; i < frq.size(); i++)
    m.setColumn(i,(float[])frq.get(i));
    m.setBounds(data.getActiveRegionOffsetSeconds(), data.getActiveRegionOffsetSeconds()+data.getDuration(),
    0f, data.getSamplingFrequency()/2f);
    return m;
    public static double[] toDouble(float[] data) {
    double[] ret = new double[data.length];
    for (int i=0; i < data.length; i++)
    ret[i] = data[i];
    return ret;
    * Differentiate a trace
    public static TimeSeries differentiate (TimeSeries src) {
    int ndat;
    float t_samp;
    int i;
    float[] tr;
    float buff;
    float buff0;
    ndat = src.getDataLength();
    t_samp = 1f/src.getSamplingFrequency();
    tr = src.getData();
    buff0 = tr[0];
    tr[0] *= 2f/t_samp;
    for(i=1;i<ndat;i++)
    buff = tr[i];
    tr[i] = (tr[i] - buff0)/t_samp;
    buff0 = buff;
    return (TimeSeries)src.newInstance(tr);
    * Integrate a trace
    * @param source source trace
    * @param method method to use: Trapezoid or Tick rule
    * @return integrated trace
    public static TimeSeries integrate(TimeSeries source, int method) {
    if (method == Params.TRAPEZOID)
    return Integrate.trapRule(source);
    else if (method == Params.TICK)
    return Integrate.tickRule(source);
    else
    throw new IllegalArgumentException("Invalid method "+method);
    * Integrates a trace using Tick's rule
    * @param source source trace
    * @return integrated trace
    public static TimeSeries integrate(TimeSeries source) {
    return integrate(source, Params.TICK);
    * Trace resampling
    * @param data source trace
    * @param newSampFreq new sampling frequency
    * @return new resampled trace
    public static TimeSeries resample(TimeSeries data, float newSampFreq) {
    float sampFreq = data.getSamplingFrequency();
    float[] newdata = interpolate(data.getData(), sampFreq, newSampFreq);
    TimeSeries res = (TimeSeries)data.newInstance(newdata);
    res.samplingFrequency = newSampFreq;
    return res;
    * Generic moving average window smoothing. <BR>
    * @param src source array
    * @param nx2 half window length
    public static Vector1D smooth(Vector1D src, int nx2) {
    return src.newInstance( smooth(src.getData(), nx2) );
    * Generic moving average window smoothing
    * @param src source array
    * @param nx2 half window length
    public static float[] smooth(float[] src, int nx2) {
    int ndat = src.length;
    float[] res = new float[ndat];
    //System.arraycopy(src, 0, res, 0, ndat);
    float sum1, sum2;
    int i, j, k;
    //System.err.println("NX2 = "+nx2);
    jpitsa.Out.cerr.println("data = "+src.length+"NX2 = "+nx2);
    for(i=nx2;i<=ndat-(nx2+1);i++) {
    sum1=0f; sum2=0f;
    for(j=1;j<=nx2;j++) {
    sum1 = sum1 + src[i-j];
    sum2 = sum2 + src[i+j];
    res[i] = (sum1+sum2+src[i])/(float)(2*nx2+1);
    for(i=1;i<=nx2-1;i++) {
    sum1=0f;
    sum2=0f;
    k = 0;
    for(j=1;j<=i;j++) {
    sum1 = sum1+ src[i-j];
    sum2 = sum2+ src[i+j];
    k = j;
    res[i] = (sum1+sum2+src[i])/(float)(2*k+1);
    for(i=1;i<=nx2-1;i++) {
    sum1 = sum2 = 0f;
    k = 0;
    for(j=1;j<=i;j++) {
    sum1 = sum1+ src[ndat-1-i-j];
    sum2 = sum2+ src[ndat-1-i+j];
    k = j;
    res[ndat-1-i] = (sum1+sum2+src[ndat-1-i])/(float)(2*k+1);
    res[ndat-1] = src[ndat-1];
    res[0] = src[0];
    return res;
    * Generic 4-point spline interpolation method.
    * @param data source data
    * @param oldSampFreq source sampling frequency (1/sampling interval)
    * @param newSampFreq target sampling frequency
    public static float[] interpolate(float[] data, // source data
    float oldSampFreq, // old sampling freq. [Hz]
    float newSampFreq) // new samp. freq. [Hz]
    int n_int = 4; /* degree of polynomial for interpoltion */
    float xa[]= new float[n_int+1]; /* interpolation buffer */
    float ya[]= new float[n_int+1]; /* interpolation buffer */
    int closest_sample=-1, int_start_sample=-1;
    float delta_value = 0f; /* error estimate for interpolated value */
    // this is because PITSA and JPITSA use different schemes for sampling freq. storing
    float t_samp_old = 1f / oldSampFreq;
    float t_samp_new = 1f / newSampFreq;
    int ndat = data.length;
    float x1=t_samp_old/t_samp_new;
    x1 *= (float)ndat;
    int ndat2 = Math.round(x1+5e-1f); // Number of data in new arrary
    float[] tr1 = data;
    float[] b1 = new float[ndat2];
    float[] prom_res= new float[2]; // temp. buffer for polint() procedure
    // 4-point Spline interpolation procedure
    float new_x;
    for (int j = 0; j < ndat2;j++){
    new_x = (float)j*t_samp_new;
    /* determine index of closest sample in trace */
    closest_sample = (int)(new_x/t_samp_old);
    if ((closest_sample >= (int)((float)n_int/2.)) &&
    (closest_sample <= ndat - (int)((float)n_int/2.) - 1))
    int_start_sample = closest_sample - (int)((float)n_int/2.) - 1;
    }else if (closest_sample < (int)((float)n_int/2.)) {
    int_start_sample = -1;
    }else if (closest_sample > ndat - (int)((float)n_int/2.) - 1) {
    int_start_sample = ndat -1 - n_int;
    for (int jj = 1;jj <= n_int; jj++) {
    ya[jj] = tr1[int_start_sample + jj];
    xa[jj] = (int_start_sample + jj)*t_samp_old;
    prom_res[0] = x1; prom_res[1] = delta_value;
    polint(xa,ya,n_int,new_x, prom_res);
    b1[j] = x1 = prom_res[0]; delta_value = prom_res[1];
    return b1;
    * Generic 4-point spline interpolation method.
    * @param data source data
    * @param newLength number of points in a new array
    public static float[] interpolate(float[] data, int newLength) {
    int n_int = 4; /* degree of polynomial for interpoltion */
    float xa[]= new float[n_int+1]; /* interpolation buffer */
    float ya[]= new float[n_int+1]; /* interpolation buffer */
    int closest_sample=-1, int_start_sample=-1;
    float delta_value = 0f; /* error estimate for interpolated value */
    // this is because PITSA and JPITSA use different schemes for sampling freq. storing
    float t_samp_old = 1f / oldSampFreq;
    float t_samp_new = 1f / newSampFreq;
    int ndat = data.length;
    float x1=t_samp_old/t_samp_new;
    x1 *= (float)ndat;
    int ndat2 = Math.round(x1+5e-1f); // Number of data in new arrary
    int ndat = data.length;
    int ndat2 = newLength;
    float t_samp_old = 1f;
    float t_samp_new = ((float)ndat)/((float)ndat2);
    float x1 = (float)ndat2;
    float[] tr1 = data;
    float[] b1 = new float[ndat2];
    float[] prom_res= new float[2]; // temp. buffer for polint() procedure
    // 4-point Spline interpolation procedure
    float new_x;
    for (int j = 0; j < ndat2;j++){
    new_x = (float)j*t_samp_new;
    /* determine index of closest sample in trace */
    closest_sample = (int)(new_x/t_samp_old);
    if ((closest_sample >= (int)((float)n_int/2.)) &&
    (closest_sample <= ndat - (int)((float)n_int/2.) - 1))
    int_start_sample = closest_sample - (int)((float)n_int/2.) - 1;
    }else if (closest_sample < (int)((float)n_int/2.)) {
    int_start_sample = -1;
    }else if (closest_sample > ndat - (int)((float)n_int/2.) - 1) {
    int_start_sample = ndat -1 - n_int;
    for (int jj = 1;jj <= n_int; jj++) {
    ya[jj] = tr1[int_start_sample + jj];
    xa[jj] = (int_start_sample + jj)*t_samp_old;
    prom_res[0] = x1; prom_res[1] = delta_value;
    polint(xa,ya,n_int,new_x, prom_res);
    b1[j] = x1 = prom_res[0]; delta_value = prom_res[1];
    return b1;
    * Butterworth Band Pass Filter
    * implements Band, Low and High Pass filters
    * All three Butterworth filters are recursive time domain filters
    * using the bilinear z-transform design after Stearns (1984)
    * They are applied in section of 30 dB/decade or 12 Db/octave for
    * the slope of the transition band. They may be given zero phase
    * characteristic by filterin the reversed filtered time seris
    * again (forwards-backwards filtering)
    * Finally, the trace is reversed to its original orientation
    * based on spr_bp_bworth (spr/spr_bpbt.c)
    * @author Denis Mishin ([email protected]) - Java code
    * @author PITSA team - original C code
    * @param trace input trace
    * @param flo low cut corner frequency [Hz]
    * @param fhi high cut corner frequency [Hz]
    * @param ns number of filter passes [Hz]
    * @param is_zph TRUE -> zero phase filter
    * @return new filtered trace
    public static TimeSeries bandpassFilter(TimeSeries trace,
    float flo,
    float fhi,
    int ns,
    boolean is_zph)
    final int MAX_SEC = 10;
    int i, k; /* index */
    int n,m,mm;
    int ndat; /* number of points in trace */
    double tsa;
    double a[] = new double[MAX_SEC+1];
    double b[] = new double[MAX_SEC+1];
    double c[] = new double[MAX_SEC+1];
    double d[] = new double[MAX_SEC+1];
    double e[] = new double[MAX_SEC+1];
    double f[][] = new double[MAX_SEC+1][6];
    double temp;
    double c1,c2,c3;
    double w1,w2,wc,q,p,r,s,cs,x;
    float tr[];
    ndat = trace.getDataLength();
    tsa = 1f / trace.getSamplingFrequency();
    tr = trace.getData();
    // remove mean
    float mean = mean(tr);
    for (i=0; i < tr.length; i++)
    tr[i] -= mean;
    /* design filter weights */
    /* bandpass */
    w1 = java.lang.Math.sin(flo*java.lang.Math.PI*tsa)/java.lang.Math.cos(flo*java.lang.Math.PI*tsa);
    w2 = java.lang.Math.sin(fhi*java.lang.Math.PI*tsa)/java.lang.Math.cos(fhi*java.lang.Math.PI*tsa);
    wc=w2-w1;
    q=wc*wc +2.0*w1*w2;
    s=w1*w1*w2*w2;
    for (k=1;k<=ns;k++)
    c1 = (float)(k+ns);
    c2 = (float)(4*ns);
    c3 = (2.0*c1-1.0)*java.lang.Math.PI/c2;
    cs = java.lang.Math.cos(c3);
    p = -2.0*wc*cs;
    r = p*w1*w2;
    x = 1.0+p+q+r+s;
    a[k]= wc*wc/x;
    b[k]= (-4.0 -2.0*p+ 2.0*r+4.0*s)/x;
    c[k]= (6.0 - 2.0*q +6.0*s)/x;
    d[k]= (-4.0 +2.0*p -2.0*r +4.0*s)/x;
    e[k]= (1.0 - p q-r s)/x;
    /* set initial values to 0 */
    for(n=0;n<=MAX_SEC;n++)
    for(m=0;m<=5;m++)
    f[n][m]=0.0;
    /* filtering */
    for (m=1;m<=ndat;m++) {
    f[1][5]= tr[m-1];
    /* go thru ns filter sections */
    for(n=1;n<=ns;n++)
    temp=a[n]*(f[n][5]-2.0*f[n][3] +f[n][1]);
    temp=temp-b[n]*f[n+1][4]-c[n]*f[n+1][3];
    f[n+1][5]=temp-d[n]*f[n+1][2]-e[n]*f[n+1][1];
    /* update past values */
    for(n=1;n<=ns+1;n++)
    for(mm=1;mm<=4;mm++)
    f[n][mm]=f[n][mm+1];
    /* set present data value and continue */
    tr[m-1] = (float)f[ns+1][5];
    // System.out.println("tr ["+(m-1)+"] = "+tr[m-1]);
    if (is_zph == true) {
    /* filtering reverse signal*/
    for (m=ndat;m>=1;m--) {
    f[1][5]= (double)tr[m-1];
    /* go thru ns filter sections */
    for(n=1;n<=ns;n++)
    temp=a[n]*(f[n][5]-2.0*f[n][3] +f[n][1]);
    temp=temp-b[n]*f[n+1][4]-c[n]*f[n+1][3];
    f[n+1][5]=temp-d[n]*f[n+1][2]-e[n]*f[n+1][1];
    /* update past values */
    for(n=1;n<=ns+1;n++)
    for(mm=1;mm<=4;mm++)
    f[n][mm]=f[n][mm+1];
    /* set present data value and continue */
    tr[m-1] = (float)f[ns+1][5];
    // restore mean
    for (i=0; i < tr.length; i++)
    tr[i] += mean;
    return (TimeSeries)trace.newInstance(tr);
    * Gaussian filter. <BR>
    * Removes mean by default
    public static TimeSeries gaussianFilter(TimeSeries src, float fCent, float alpha) {
    return gaussianFilter(src, fCent, alpha, true);
    * Gaussian bandpass filter
    * @param src source trace
    * @param fCent central frequency value
    * @param alpha bandwidth
    * @param rmean remove mean first flag
    * @return new filtered vector
    public static TimeSeries gaussianFilter(TimeSeries src, float fCent, float alpha, boolean rmean) {
    float[] fc = new float[1]; fc[0] = fCent;
    float[] al = new float[1]; al[0] = alpha;
    return gaussianFilter(src, fc, al, rmean);
    * Gaussian bandpass filter
    * @param src source trace
    * @param fCent central frequency values
    * @param alpha bandwidths
    public static TimeSeries gaussianFilter(TimeSeries src, float fCent[], float alpha[], boolean rmean) {
    float[] sourceData = src.getData();
    float mean = 0f;
    int i;
    if (rmean) {
    mean = mean(sourceData);
    for (i=0; i < sourceData.length; i++)
    sourceData[i] -= mean;
    ComplexVector spec = DFFT(new ComplexVector(src.getData(),null), true);
    int npoints = spec.getDataPointsNumber();
    float nyq = src.getSamplingFrequency()/2f;
    // ---- computing the Gaussian distribution function
    float[] gaus = new float[npoints];
    float freqIncrement = (2f*nyq)/((float)npoints);
    int cp = 0; float f = 0f;
    while (f <= nyq && cp < (npoints/2) ) {
    gaus[cp] = Filter.gaussianWindow(f,fCent,alpha);
    cp++; f += freqIncrement;
    int last_index = gaus.length-1;
    for (cp=0; cp < (npoints/2); cp++)
         gaus[last_index - 1] = gaus[cp];
    float[] real = extractPart(spec,Params.REAL);
    float[] imag = extractPart(spec,Params.IMAGINARY);
    //System.out.println("Gaus: real.length="+real.length+" spec.length="+npoints+
    //     " stop at "+f+" nyq="+nyq);
    real = multiplicate(real,gaus);
    imag = multiplicate(imag,gaus);
    //real = glue(real, invert(real));
    //imag = glue(imag, invert(imag));
    ComplexVector inv = DFFT(new ComplexVector(real,imag), Params.INVERSE);
    real = extractPart(inv, Params.REAL);
    float[] data = new float[real.length/2];
    System.arraycopy(real,0,data,0,data.length);
    TimeSeries result = new TimeSeries(data, nyq*2f);
    float[] data = sourceData;
    System.arraycopy(real,0,data,0,data.length);
    if (rmean) {
    for (i=0; i < data.length; i++)
    data[i] += mean;
    TimeSeries result = (TimeSeries)src.newInstance(data);
    return result;
    * Discretisation of source trace data
    * Discretization will treat the input trace as a pseudo-continuous trace from which

  • How can I extract a gaussian function out of a spectrum which has five gaussain functions....

    I have a spectrum which has five gaussian functions. but I have to extract this Gaussian functions from the spectrum. There are diferent gaussian functions. What are the possible methods for extracting the gauss functions using labview. I have attached a picture to give you a picture. The solid line is the one I have and the dotted lines are the individual Gaussian function which will be extracted.
    Note: the Gaussian function center number and width are known.
    Attachments:
    Picture1.png ‏27 KB

    Let me get this straight.
    You have:
       The experimental data set (spectrum)
       The number of Gaussian curves you want to use for your curve fit
       The center positions and variances for all of your Gaussians
    You need:
       The height of the Gaussian curves
    Is that it? If so, all you need to do is set up an optimizing routine, using some measure to optimize (i.e., sum of abs(residuals) or residuals squared for each data point) and the acceptable final error for your solution.
    A modified Simplex routine should work well, there may be others which would be more efficient, but you're talking about a trivial amount of comkputer time unless you have a gazillion of these spectra to fit.
    If that is not your problem, please describe exactly what data you have and what you need to calculate more fully.
    LabVIEW can use essentially any method for solving this problem that any other computer language can, but it is not likely to be a simple canned plug-in (at least it won't be one which you get in the vanilla version of LabVIEW), you'll have to put it together yourself.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • How can I measure the full width half max pulse-width of a gaussian function?

    Hi I am measuring a laser pulse using a Tektronix scope and feeding that data into my labview (v 7.1) based data system on a Mac OS X computer. I want to measure the full width pulse at half the maximum peak. The included measurement VIs that come with labview and the tek scope dont seem to do the job (even though the scope itself can do the measurement). I've attached my example VI. If anyone has any suggestions that would be great.
    Thanks,
    Paul
    Attachments:
    test scope.vi ‏255 KB

    If you can display a trace on the screen, you can get the full width at half maximum. LabVIEW gives you several options:
    Use the Pulse Parameters VI to determine the width directly. This will be a width based solely on the data with no assumption as to an underlying model.
    Use the Levenberg Marquardt VI to fit a gaussian to your curve, then calculate the full width at half maximum from the coefficients. Levenberg Marquardt is a least-squares/gaussian algorithm, so is somewhat noise sensitive.
    Use one of the minimizer functions (e.g. Downhill Simplex) to construct your own fit using a different assumed error distribution. If you are unsure how to do this, check out a copy of Numerical Recipes in C by Press et. al. and read the section on data fitting.
    Do your own data based calculation. Find the peak with Peak Detector. This will give you the magnitude, but you may want to verify it with a polynomial fit (parabola is usually good enough) across the top of the peak to avoid noise problems. Then find the positions of the half-maxima on either side of the peak. The Interpolate 1D Array will probably prove useful for this.
    Choose your method depending on your pain threshold and how accurate and robust you need the result to be. Good luck!
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Firewire does not function after uninstalling macfuse and an out of date version of NTFS32 and then installed latest version of Tuxera NTFS for Mac.

    I purchased a 3TB HDD (WD USB 3.0 $100) to replace the 2TB Seagate for a new Time Machine HDD. The 2B was full and backups were deleting older files. The 3TB was formatted NTFS and I want to "recover" the included SW before I reformatted the HDD for the iMac. I discovered that MacFuse was out of date and unsupported and my NTFS-32 was also out of date so I uninstalled both and then installed the most recent version of Tuxera NTFS for Mac. I rebooted and discovered that the FW800 port was unresponsive. Below is the EtreCheck report:
    Problem description:
    Firewire does not function after uninstalling macfuse and an out of date version of NTFS32 and then installed Tuxera NTFS for Mac.
    EtreCheck version: 2.0.8 (95)
    Report generated October 30, 2014 7:11:17 PM EDT
    Hardware Information: ℹ️
      iMac (24-inch Mid 2007) (Verified)
      iMac - model: iMac7,1
      1 2.8 GHz Intel Core 2 Duo CPU: 2-core
      4 GB RAM
      BANK 0/DIMM0
      2 GB DDR2 SDRAM 667 MHz ok
      BANK 1/DIMM1
      2 GB DDR2 SDRAM 667 MHz ok
      Bluetooth: Old - Handoff/Airdrop2 not supported
      Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
      ATI,RadeonHD2600 - VRAM: 256 MB
      iMac 1920 x 1200
    System Software: ℹ️
      OS X 10.8.5 (12F45) - Uptime: 0:17:34
    Disk Information: ℹ️
      WDC WD5000AAKS-40TMA0 disk0 : (500.11 GB)
      S.M.A.R.T. Status: Verified
      disk0s1 (disk0s1) <not mounted> : 210 MB
      ML 10.8 (disk0s2) /  [Startup]: 499.25 GB (20.92 GB free)
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
    USB Information: ℹ️
      Apple Inc. Built-in iSight
      Apple Computer, Inc. IR Receiver
      Logitech USB Receiver
      Apple Inc. Bluetooth USB Host Controller
    Gatekeeper: ℹ️
      Mac App Store and identified developers
    Kernel Extensions: ℹ️
      /Applications/Hardware Monitor ƒ/HardwareMonitor.app
      [loaded] com.bresink.driver.BRESINKx86Monitoring (7.0) Support
      /Applications/Parallels Desktop.app
      [not loaded] com.parallels.kext.hidhook (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.hypervisor (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.netbridge (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.usbconnect (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.vnic (8.0 18615.948847) Support
      /Applications/Toast Titanium v11.1/Spin Doctor.app
      [not loaded] com.hzsystems.terminus.driver (4) Support
      /Applications/Toast Titanium/Toast Titanium v11.1 (1072).app
      [not loaded] com.roxio.TDIXController (2.0) Support
      /Library/Application Support/Symantec/AntiVirus
      [loaded] com.symantec.kext.SymAPComm (12.2f1 - SDK 10.6) Support
      /System/Library/Extensions
      [loaded] com.Logitech.Control Center.HID Driver (3.9.0 - SDK 10.6) Support
      [loaded] com.eltima.ElmediaPlayer.kext (1.58 - SDK 10.4) Support
      [not loaded] com.hzsystems.driver.CDSDAudioCaptureSupport (1.5) Support
      [not loaded] com.increw.kext.speedit (0.32) Support
      [loaded] com.logitech.manager.kernel.driver (4.10.0 - SDK 10.8) Support
      [not loaded] com.olympus.CamBlockCommandsDevice (2.0.0) Support
      [not loaded] com.olympus.CamBlockCommandsDeviceUP (2.0.0) Support
      [not loaded] com.palm.ClassicNotSeizeDriver (3.2.1) Support
      [not loaded] com.roxio.BluRaySupport (1.1.6) Support
      [not loaded] com.seagate.driver.PowSecDriverCore (5.1.1) Support
      [loaded] com.symantec.kext.internetSecurity (5.2f1 - SDK 10.6) Support
      [loaded] com.symantec.kext.ips (3.5f1 - SDK 10.6) Support
      [loaded] com.symantec.kext.ndcengine (1.0f1 - SDK 10.6) Support
      [loaded] com.taoeffect.ispy.kext (2.0.2 - SDK 10.2) Support
      /System/Library/Extensions/OlympusDSCDriver.kext/Contents/PlugIns
      [not loaded] com.olympus.CamFWSerialBusProtocolTransport (2.0.0) Support
      [not loaded] com.olympus.CamUSBMassStorageClass (2.0.0) Support
      /System/Library/Extensions/Seagate Storage Driver.kext/Contents/PlugIns
      [not loaded] com.seagate.driver.PowSecLeafDriver_10_4 (5.1.1) Support
      [not loaded] com.seagate.driver.PowSecLeafDriver_10_5 (5.1.1) Support
      [not loaded] com.seagate.driver.SeagateDriveIcons (5.1.1) Support
      /Users/[redacted]/Downloads/LCC Installer.app
      [not loaded] com.Logitech.Unifying.HID Driver (1.3.1 - SDK 10.8) Support
    Startup Items: ℹ️
      TuxeraNTFSUnmountHelper: Path: /Library/StartupItems/TuxeraNTFSUnmountHelper
      Startup items are obsolete and will not work in future versions of OS X
    Launch Agents: ℹ️
      [running] com.canon.MFManager.plist Support
      [not loaded] com.cooliris.SetLaunchArch.plist Support
      [loaded] com.google.keystone.agent.plist Support
      [running] com.Logitech.Control Center.Daemon.plist Support
      [running] com.logitech.manager.daemon.plist Support
      [running] com.micromat.TechToolProAgent.plist Support
      [loaded] com.oracle.java.Java-Updater.plist Support
      [running] com.seagate.SeagateStorageGauge.plist Support
      [running] com.symantec.uiagent.application.plist Support
    Launch Daemons: ℹ️
      [loaded] com.adobe.fpsaud.plist Support
      [running] com.cleverfiles.cfbackd.plist Support
      [running] com.eltima.ElmediaPlayer.daemon.plist Support
      [loaded] com.embraceware.awaken.plist Support
      [loaded] com.google.keystone.daemon.plist Support
      [loaded] com.macpaw.CleanMyMac2.Agent.plist Support
      [running] com.micromat.TechToolProDaemon.plist Support
      [loaded] com.microsoft.office.licensing.helper.plist Support
      [loaded] com.oracle.java.Helper-Tool.plist Support
      [loaded] com.oracle.java.JavaUpdateHelper.plist Support
      [loaded] com.prosofteng.DriveGenius.locum.plist Support
      [running] com.smithmicro.schedulerdaemon.plist Support
      [loaded] com.symantec.liveupdate.daemon.ondemand.plist Support
      [failed] com.symantec.liveupdate.daemon.plist Support
      [not loaded] com.symantec.sep.migratesettings.plist Support
      [running] com.symantec.sharedsettings.plist Support
      [running] com.symantec.symdaemon.plist Support
      [running] com.taoeffect.ispyd.plist Support
      [running] com.wdc.drivemanagerservice.plist Support
    User Launch Agents: ℹ️
      [loaded] com.adobe.ARM.[...].plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.scheduledScan.plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.trashWatcher.plist Support
      [running] com.prosofteng.DGMonitor.plist Support
      [running] com.smithmicro.cleaning.schedulermailer.plist Support
      [running] com.taoeffect.EspionageHelper.plist Support
    User Login Items: ℹ️
      Speedy Mac Application (/Applications/Speedy Mac/Speedy Mac.app)
      AwakenHelper Application (/Users/[redacted]/Library/Application Support/Awaken/AwakenHelper.app)
      GetBackupAgent Application (/Users/[redacted]/Library/Application Support/BeLight Software/Get Backup 2/GetBackupAgent.app)
      WDDriveUtilityHelper Application (/Users/[redacted]/Downloads/WD/WD Drive Utilities.app/Contents/Resources/WDDriveUtilityHelper.app)
      ClustersHelper Application (/Library/PreferencePanes/Clusters.prefPane/Contents/Resources/ClustersHelper.a pp)
      RealPlayer Downloader Agent Application (/Users/[redacted]/Library/Application Support/RealNetworks/RealPlayer Downloader Agent.app)
      SAVDiskMountNotify UNKNOWN (missing value)
      ScanNotification UNKNOWN (missing value)
      Launch Nikon Message Center 2 Application (/Applications/Nikon Software/Nikon Message Center 2/Nikon Message Center 2.app/Contents/SharedSupport/Launch Nikon Message Center 2.app)
    Internet Plug-ins: ℹ️
      EPPEX Plugin: Version: 10.0 Support
      Flash Player: Version: 15.0.0.189 - SDK 10.6 Support
      AdobePDFViewer: Version: 9.4.6 Support
      Unity Web Player: Version: UnityPlayer version 3.5.3f3 - SDK 10.6 Support
      NPVirtools: Version: 4.0 Support
      iPhotoPhotocast: Version: 7.0 - SDK 10.8
      RealPlayer Plugin: Version: (null) Support
      DirectorShockwave: Version: 11.6.8r638 Support
      QuickTime Plugin: Version: 7.7.1
      FlashPlayer-10.6: Version: 15.0.0.189 - SDK 10.6 Support
      GarminGpsControl: Version: 2.9.3.0 Release Support
      ToontownBundleManager: Version: (null) Support
      CANONiMAGEGATEWAYDL: Version: 3.1.0.2 Support
      Silverlight: Version: 5.1.10411.0 - SDK 10.6 Support
      OVSHelper: Version: 1.0 Support
      CoolirisWebKitPlugin: Version: (null) Support
      Google Earth Web Plug-in: Version: 6.1 Support
      Flip4Mac WMV Plugin: Version: 3.2.0.16   - SDK 10.8 Support
      SharePointBrowserPlugin: Version: 14.4.4 - SDK 10.6 Support
      JavaAppletPlugin: Version: Java 7 Update 67 Check version
      OfficeLiveBrowserPlugin: Version: 12.3.6 Support
    User Internet Plug-ins: ℹ️
      BrowserPlus_2.9.2: Version: 2.9.2 Support
      Picasa: Version: 1.0 Support
    Safari Extensions: ℹ️
      DivX Plus Web Player HTML5 <video>
      Open in Internet Explorer
      DivX HiQ
      Aimersoft Video Converter
    3rd Party Preference Panes: ℹ️
      BrowserPlus  Support
      Clusters  Support
      Déjà Vu  Support
      Flash Player  Support
      Flip4Mac WMV  Support
      Java  Support
      Logitech Control Center  Support
      Logi Preference Manager  Support
      MenuMeters  Support
      Perian  Support
      Symantec QuickMenu  Support
      TechTool Protection  Support
      Tuxera NTFS  Support
    Time Machine: ℹ️
      Skip System Files: NO
      Auto backup: YES
      Destinations:
      iMac TimeMachine [Local]
      Total size: 2 TB
      Total number of backups: 80
      Oldest backup: 2011-09-18 05:21:33 +0000
      Last backup: 2014-10-05 20:18:55 +0000
      Size of backup disk: Excellent
      Backup size 2 TB > (Disk size 0 B X 3)
      /sbin excluded from backup!
      /usr excluded from backup!
      /System excluded from backup!
      /bin excluded from backup!
      /private excluded from backup!
      /Library excluded from backup!
      /Applications excluded from backup!
    Top Processes by CPU: ℹ️
          2% WindowServer
          0% Speedy
          0% SystemUIServer
          0% RealPlayer Downloader Agent
          0% ps
    Top Processes by Memory: ℹ️
      288 MB SymDaemon
      150 MB Speedy
      137 MB Safari
      82 MB WebProcess
      82 MB coreservicesd
    Virtual Memory Information: ℹ️
      2.17 GB Free RAM
      1.46 GB Active RAM
      148 MB Inactive RAM
      518 MB Wired RAM
      388 MB Page-ins
      0 B Page-outs
    I hope someone has some ideas! TIA.

    Do you have another cable you can test with? Do you have access to another computer with Firewire you can test with?
    FireWire Device not Working
    FireWire/USB - Quick Assist

  • Creating a random noise (Gaussian) using Matlab Script

    Hello,
    Since I only have Labview 6.1 base, I can't use the white-noise generator in Labview. I'm thinking of using the Matlab Script. I have Matlab 2006R installed in the same computer. However, I tried running the program and nothing happened (I used the help example "a=rand(50);surf(a)" in the Matlab Script.
    Why it's not calling the Matlab, or is there a better way to create a Gaussian distribution in Labview 6.1 Base?
    Thanks a lot!

    Hello,
    Why are you unable to use the Gaussian White Noise VI in LabVIEW 6.1?  It is under the Analyze >> Signal Processing >> Signal Generation palette.  I have attached a simple VI that illustrates creating a matrix.
    If you wish to use the MATLAB® script node, let's first make sure it is working correctly.  Try opening one of the LabVIEW shipping examples.  Browse to <LabVIEW>\examples\scriptnode and open "HiQMATLAB_Fractal.llb."  Then open "MATLAB Fractal.vi."  Run the VI.  Do you get any error windows that pop up?  If not and you see a picture of a fractal appear, then the connection to the MATLAB software is working correctly.  In your VI, try creating an error out indicator from the MATLAB script node and see if any errors appear.
    If you do see an error in the shipping example, it means there is a problem with the software connection.  Make sure that you have launched the MATLAB software at least once after you installed it.  This will set up the necessary connection information.  Then launch LabVIEW.  If this isn't the issue, we could try manually restoring the server commands.  Make sure LabVIEW and the MATLAB software are not running.  Go to a command prompt, browse to the MATLAB bin directory (e.g. MATLAB\R2006b\bin), and type
    matlab -regserver
    Quit the instance of the MATLAB software that appears and launch LabVIEW.  If this also fails, please post again with any error information you receive.
    Also, the rand function in your script will not generate a Gaussian distribution. You will need to use the randn function instead.
    MATLAB® is a registered trademark of The MathWorks, Inc.
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
    Edit: For some reason, I am unable to attach the VI.  I have included a picture instead.
    Message Edited by GrantM on 08-08-2008 02:50 PM
    Attachments:
    Gaussian Matrix.png ‏35 KB

  • Bessel function best fit

    Hi all,
    Quite new to LabVIEW. I am capturing diffraction images that are described by Bessel J functions. The maxima of the diffraction correspond to the maxima of the Bessel J functions ( or zeros of 1st derivative).  I wish to fit the diffraction image intensities to a Bessel J function , pixel value -> best fit to x in J(x). Has anyone previously done this before? I know the order n of the Bessel function but not necessarilly the pixel where x=0.
    Similarly, I hope to fit the diffraction image of a pinhole which is an Airy Disk to use as calibration ie pixel -> m^-1.
    Any help or suggestions would be gratefully accepted.
    Regards,
    Leeser 

    Leeser,
    Considering you are relatively new to labVIEW, your program was very well structured and seems to approach the problem in the right manner. As you correctly guessed right from the beginning, no-one it seems has attempted fitting a Bessel function to their data. The 'best-fit' VI's found in the 'Fitting Pallette' are more generally concerned with parametric, powers and exponential type functions, rather than more complex differentials such as the Bessel. In cases similar to yours, it seems that people haave tried adopting the Levenberg-Marquardt algorithm which is a Non-Linear Fitting VI found in the Fitting Pallette. This is the Lev-Mar VI which Kristie Elam reccomended you using for the Airy disc. This function allows one to define the equation with which they wish to fit their data, but due to the complexity of the Bessel function, this may be quite tricky.
    I have been working on an example VI which provides the basic structure of what you need to implement in to your program. The Bestfit VI converts a picture using the IMAQ functions and then plots the converted data. You can manipulate the row control to choose which row of pixels you wish to analyse. The VI then calls the Lev-Mar Best Fit function which in itself calls the Bessel Formulae VI which is a template for the Bessel Formulae that the Lev-Mar function will use in its best-fit approximation. It is within this VI that you will need to enter the neccessary formulae to produce your theoretical Bessel function. The Lev-Mar Bestfit function can then use this data to plot a Least Squares Best Fit approximation against your spectrum.
    Aswell as the Bestfit and Bessel Formulae VI's, I have attached a Gaussian Example VI which gives a complete example of a Bestfit approximation using this method. Furthermore, I have attached a couple of VI's that I found which I hope may help you to develop the Bessel formulae. These include a table of Bessel roots, which you may be able to use to produce a table of the derivative roots, those found on your schematic.
    I really hope this information and the files I have attached will be of use to you, I'm just sorry there isn't a direct tool with which you can produce the bestfit approximation. Keep me posted on your progress as I've been working on this for a few days now and would like to see how it goes!
    With regards to the Airy disc, I would keep on with the files that you received from Kristie Elam, hopefully using the same method with both the Bessel functions and Airy disc might make things easier for you.
    I hope this informtaion is of use to you, best wishes and good luck!
    Rob
    Rob L
    NI Applications Engineer
    UK & Ireland
    It only takes a click to rate this message ;-)
    Attachments:
    Bessel Bestfit.zip ‏98 KB

  • Wire: Function Conflict, Static VI Reference

    Hello Community,
    Sorry if this has already been answered before, but I have spent an hour searching. I am trying to learn a little about using subVIs to clean up my code.
    I'm trying to connect a static VI reference of a Gaussian function that I made to the Nonlinear Curve Fit.vi, but I get a broken wire which says "function conflict".
    When I create constants for the output of my Gaussian VI and the input of the Nonlinear Curve Fit.vi, they are clearly different classes.
    Could someone show me how to edit my Gaussian VI to match the class properly? I'd greatly appreciate it.
    Thanks,
    -Patrick
    Solved!
    Go to Solution.
    Attachments:
    pat_gaussian_fit.vi ‏24 KB
    pat_gaussian_fit.vi ‏24 KB

    Your model subvi needs a connector pattern that is identical to the template. Start with the template mentioned in the help and only modify the code, not the existing controls and indicators. Simply leave unused terminals disconnect, don't delete them.
    LabVIEW Champion . Do more with less code and in less time .

  • Gaussian blur results in banding

    Here's a piece of wall I try to gaussian blur (> 60 radius) and always results in bandings. I tried adding noise but it doesn't help, unless I add so much noise the image becomes unrecognizable.
    Here's the same image in case the one above is re-compressed
    blur
    In case you wonder why blur this image, there is an electrical outlet near this wall (not shown) that I edited out and need to blur the edited area, and realize the resulting banding is caused by the wall and photoshop.
    Are there other solutions?
    I'm using photoshop CS4 in 16 bit mode.

    Yes, I know what you're talking about.  It's as though you don't want to accept the explanation.
    With 24 bit color you will see the divisions between regions of identical RGB values in the 24 bit color space where they change by one level.  It's most easily seen in gray or near gray gradients of dim luminosity (which is what you have here).
    There is no uneven banding in the data in the image you posted.  It's a 16 bit PNG file and the data is perfectly clean and smooth, which is what you'd expect from a large radius Gaussian Blur.
    If you're seeing uneven or more severe banding on your display only, it's possible something in your system setup is amiss (e.g. a poorly constructed monitor profile, or a malfunctioning display driver), causing you to see multi-level jumps between adjacent regions of color.
    On my very well tuned 24 bit color setup I can see the even (but very subtle) banding of your 16 bit image.  Doing the following hides it completely:
    If your display setup is functioning optimally you won't sense any banding in the above image (after having clicked it to make it show at full size of course).
    -Noel

  • Urxvt's Gaussian Blur

    I cannot seem to get urxvt's Gaussian Blur working. It should be enabled with the switch -blr HxV, where H and V are numbers, but this errors with:
    "unknown or malformed option"
    Also, the resource blurRadius, doesn't seem to work either. These functions are documented in the manpages, but is does not seem to work. Does anyone have the same problem? I'm using version v9.06 - released: 2008-06-15.
    Last edited by OutOfPhase (2009-01-08 23:19:30)

    Are you sure it's compiled with afterimage support?

  • Are there functions to call Adobe's built-in filters?

    Like say I wanted to call Gaussian Blur that photoshop already has, are there functions to do this?  Or would I have to create my own Gaussian Blur?
    Thanks

    Yes, from automation plugins or scripts.
    From other plugins: no, you'd have to create your own.

  • Can someone verify my code for calculatin​g a Gaussian kernel?

    I've attached my VI for calculating a Gausssian kernel function of selectable width and resolution.  I am not an expert in mathmatics and I was hoping someone on here could confirm the validity of my code.  If anyone has any suggestions please let me know. 
    Eric
    Attachments:
    Old Gaussian Kernel.vi ‏24 KB

    To better show what it is I'm trying to accomplish, I've attached
    the top level VI that's using the kernel function, entitled "Pattern
    Analysis of IPIs 2," .  The zip folder contains the top level VI, a
    folder with all the subVI's and two data files.  Open the "Pattern
    Analysis of IPIs 2" VI and go to the "Files" selector tab toward the
    bottom right of the front panel.  Here you'll  be able to select the
    folder containing the data files.  You'll need to unzip the attached
    folder and save it somewhere, then select that folder as the "current
    folder" to be opened (you don't need to specify which data file to
    open, it will open both).  Once the folder is selected you can run the
    VI and view its results. 
    When the program begins
    running a boolean indicator located in the bottom left corner will
    appear red and the slider bars along the bottom will be disabled.  When
    everything has been calculated the boolean will turn green and the
    slider bars will become enabled. Choose the selector tab entitled "SPI,
    SDF & SDD" to view the spike density function.  The spike density
    function (SDF) is what's being created with the Gaussian kernel.  The
    enabled slider bars allow you to adjust the x-axis values of the plot. 
    The cursors on the plot indicate indicate the start, peak and end of
    high rate bursts.  It may be easier to visualize this by viewing the
    raw data located at the "Wfm Absolute and Relative Time" selector tab. 
    To reduce file sizes the raw data has areas of "quite" removed, so you
    will only see the voltage change events, represented by what appear to
    be vertical lines.
    To move to the next data file, click
    the button entitled "Save and Go to Next" located in the bottom right
    hand corner.  A prompt will appear asking if you want to save the data,
    click "No" and the next file will automatically be loaded.  To stop the
    VI, wait until the boolean is green and the slider bars are enabled,
    then click the "Stop" bottom located at the bottom right.  It may take
    a few seconds for the VI to stop.
    Moving to the
    block diagram, you'll see a yellow subVI with black writing that says
    "SDF,"  this is where the SDF is calculated.  Open the front panel and
    block diagram of this subVI.  On the block diagram you'll see the subVI
    entitled "Gaussian Kernel," this is the subVI you saw yesterday.  The
    generated Gaussian kernel is alligned at peak pulse times (can be seen
    in the graph entitled "Gaussian Kernel Alligned at Peak Times") and
    summed to create the SDF.  I only choose this method of generating the
    SDF because it seemed intuitive to me, it may be wrong.  If it is,
    could you please demonstrate how to program the convolution. 
    Ultimately, I'm trying to achieve the plot described on the third page
    of the attached paper.
    Attachments:
    Pattern Analysis.zip ‏2916 KB
    Stereotyped temporal patterns in electrical communication.pdf ‏380 KB

Maybe you are looking for

  • Error when clicking on EDIT button on CCM 2.0

    Hi Experts, we are experiencing lot of errors when we click on the "EDIT" or any other button on CCM of a CATALOG. The Error message we are getting is "Errors while reading catalogs,errors while reading master catalog". When we check the Display logs

  • Acrobat X and Yosemite Issues

    I have been using acrobat 10 and OS Mavericks to manage my office documents using a Fujitsu scanner. After I upgraded to OS Yosemite, I have been unable to print any of the documents that I have scanned. The image of the doc will show up on the print

  • Bank name change in manual posting

    Dear Gurus, Name of the Bank is showing Wrongly in FF67 overview.  Manual Posting has been done for this also. How can i change the Name. Regards, Rohit Raj...

  • JRockit with -Xmanagement & JBoss 4 does not start

    Hi, I tried to start JBoss 4 with the management console: a fresh JBoss 4, just compiled from source with no special application on it, that starts alright with JRockit without the management console (and also with Sun JVM jdk 1.5). Does anybody know

  • Develop module disabled

    I am a registered user of Lr 5.1 (1160-4001-2645-0882-9537-1138) and today an error message appeared in the Develop window reading: "Develop module is disabled. Please renew your membership to reactivate the Develop module". I never got such a messag