Does anyone know why this script isnt working?

6 Ansichten (letzte 30 Tage)
Siamak Seyedzadeh
Siamak Seyedzadeh am 20 Mai 2020
Kommentiert: Walter Roberson am 21 Mai 2020
clc;clear;close all;
N=10;
s0=[-pi:2*pi/N:pi];
s=s0(randperm(N)); %Performs a random permutation of the integers
from 1 to N
x=.5+asin(sin(1*s))/pi;
[dummy,index]=sort(s); % orders the elements of s in ascending order
Y=model(x);
yr=y(index);
spectrum=(abs(fft(yr))).^2/N; % fft is the fast Fourier transform
V1=2*sum(spectrum(2:M+1));
V=sum(spectrum(2:N));
S1=V1/V;
  1 Kommentar
Siamak Seyedzadeh
Siamak Seyedzadeh am 20 Mai 2020
Bearbeitet: Siamak Seyedzadeh am 20 Mai 2020
This code has been written for sensivity analysis based on Variance Method.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 20 Mai 2020
from 1 to N
from() is a Java Date method that does not expect character vectors '1', 'to', 'and 'N' as inputs.
Perhaps you wanted to code a for loop, but it is not obvious to me what you would be looping over.
  2 Kommentare
Siamak Seyedzadeh
Siamak Seyedzadeh am 21 Mai 2020
Dear Walter
Thanks for your reply. This code has been quoted in the book "Global Sensitivity Analysis The Primer" by Andrea Saltelli and et al.
Walter Roberson
Walter Roberson am 21 Mai 2020
clc;clear;close all;
N=10;
s0=[-pi:2*pi/N:pi];
s=s0(randperm(N)); %Performs a random permutation of the integers from 1 to N
x=.5+asin(sin(1*s))/pi;
[dummy,index]=sort(s); % orders the elements of s in ascending order
Y=model(x);
yr=y(index);
spectrum=(abs(fft(yr))).^2/N; % fft is the fast Fourier transform
V1=2*sum(spectrum(2:M+1));
V=sum(spectrum(2:N));
S1=V1/V;
However this needs a function named model() that is not part of MATLAB or any toolboxes that I can see.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by