matlab - Fit sinusoidal models -


I have tried to fit the following cineaside model by the following model, which means the deterministic model + white noise: < / P>

  function [x] = Generated (N, M, A3) F1 = 100; F2 = 200; T = 1 / f1; For T = 0: n * t / m: n * twn (t) = rand (1, t) * 2-1; X (t) = 20 * sin (2 * pi * f1 * t) + 30 * because (2 * pi * f2 * t) + a3 * wn (t); End;   

But when I run using the following command:

  generated (100,10,40)   

I got the following error:

  The subtitle index should be either real positive integer or logical. Error generating (line 6) WN (t) = rand (1, t) * 2-1;   

So what's wrong? As I know I can use two parameters for the rand function? What's the problem here?

UPDATED: I have done it for fixing

  function [x] = generated (N, M, A3) WN = []; F1 = 100; F2 = 200; T = 1 / f1; K = 0; T = 0: n * t / m: n * t% wn (k) = rand (1,1) * 2-1; % X (k) = 20 * sin (2 * pi * f1 * t) + 30 * cos (2 * pi * f2 * t) + a3 * wn (k); % K = k + 1; WN = Rand * 2-1; Disp (20 * sin (2 * pi * f1 * t) + 30 * because (2 * pi * f2 * t) + a3 * wn); End;   

and the result

  generated (1000,10,40) 25.4143 -1.4678 66.9518-9.6293 51.9 928 55.3843 59.4956 -3.2451 21.9826 10.7896 54.0055    

I have solved it like this:

  function x = Generate (N, M, A3) F1 = 100; F2 = 200; T = 1 / F1; T = (0: (N * T / M): (N * T)); '; Wn = RAND (Length (T), 1). * 2 - 1; X = 20. * Sin (2. * P * F 1. * T) + 30. * Cos (2. * P * F 2. * T) + A3 * Wn; End    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -