Jess Stuart - MATLAB Cody - MATLAB Central

Jess Stuart

11357
Rank
4
Badges
475
Score
51 – 59 of 59

Jess Stuart received Solver badge for Solution 1114855

on 2 Feb 2017

Jess Stuart submitted a Comment to Solution 1114065

Here is my algorithm that "failed" the isequal test by -5e-14 on a few values. I thought I would actually try to write a somewhat fast algorithm instead of just a for loop calling conv() repeatedly and reallocating memory each time. function q = polypow(p,N) q=ifft((fft([p zeros(1,(N-1)*(length(p)-1))])).^N); end

on 2 Feb 2017

Jess Stuart received Commenter badge for Solution 1114065

on 2 Feb 2017

Jess Stuart submitted a Comment to Solution 1114065

This is a numerical algorithm and is not exact, but very accurate. I'm failing the test because the output for p=1:5; N=3 is off by this amount... -3.4972e-14 8.8818e-15 3.5527e-14 0.0000e+00 0.0000e+00 -2.8422e-14 Columns 7 through 12: 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 -5.6843e-14 Column 13: 0.0000e+00 COMPLETELY RIDICULOUS!!!!. Using isequal() is a poor choice for evaluating numerical algorithms.

on 2 Feb 2017

51 – 59 of 59
Go to top of page