2014-09-16 2 views
0

Я пытаюсь сделать график трех векторов столбцов прямо сейчас, чтобы сделать трехмерный участок поверхности, но выход является просто прерывистой линией. Любая помощь приветствуется, код ниже. Извините заранее за запутанные имена переменных.Как правильно сделать трехмерный график в Scilab?

co = 29;    
BF = .0446; 
WPW = 50;  
E = [0:0.01:2]; //sets up a column vector 
p = []; 
WBR =[]; 
w = []; 
t = 8.64E13; 
delta = [0:0.5:100]; 
R =[]; 
DeltaMu = []; 
Total = []; 

//begin program iteration through k; change "k" value in for loop to change 
//the number of iterations the program runs over, and thus the amount 
//of degrees of freedom 

k = 200; 
for i = 1:k, 

I = 12.5 + 0.167*i;   
mu = I/co;   
sigma = .11*mu;    

cdf = cdfnor("PQ", E, mu*ones(E), sigma*ones(E)); 

n = 201;       // variable over which the loop is iterated  
pdf = zeros(201,1);   // sets up an appendable matrix of all zeros  

temp = 0;      //initiates a temporary integer variable 
while n > 1, 
    temp = cdf(n) - cdf(n-1); //assigns a value to the temp variable every pass 
    pdf(n) = temp;   //assigns the temp value to the nth slot in the 
          //column vector, works through the matrix backwards 
    n = n-1;    //iterates the while loop on n 
end      //breaks from while loop after n hits 1 

temp = cdf(n); 
pdf(n) = temp; 

n = 201; 
while n > 1, 
    a = exp(-WPW*exp(-delta(n)*(1-E))); 
    n = n-1; 
end 

n = 201;       // variable over which the loop is iterated 
prob = zeros(201,1);    // sets up an appendable matrix of all zeros 
temp = 0;      //initiates a temporary integer variable 
while n > 1, 
    temp = a(n)*pdf(n);  //assigns a value to the temp variable every pass 
    prob(n) = temp;   //assigns the temp value to the nth slot in the 
          //column vector, works through the matrix backwards 
    n = n-1;    //iterates the while loop on n 
end      //breaks from while loop after n hits 1 

WBR(i) = sum(prob)*BF  
w(i) = mu      
end 

//begin program iteration through k; change "k" value in for loop to change 
//the number of iterations the program runs over, and thus the amount 
//of degrees of freedom 

k = 200; 
for i = 1:k, 

mu = .5*i;    
sigma = .1*mu;   

cdf = cdfnor("PQ", delta, mu*ones(delta), sigma*ones(delta)); 

n = 201;       // variable over which the loop is iterated 
pdf = zeros(201,1);   // sets up an appendable matrix of all zeros 
temp = 0;      //initiates a temporary integer variable 
while n > 1, 
    temp = cdf(n) - cdf(n-1); //assigns a value to the temp variable every pass 
    pdf(n) = temp;   //assigns the temp value to the nth slot in the 
          //column vector, works through the matrix backwards 
    n = n-1;    //iterates the while loop on n 
end      //breaks from while loop after n hits 1 

temp = cdf(n); 

p = 1-(exp(-t*exp(-delta)));  

n = 201;       // variable over which the loop is iterated 
Psw = zeros(201,1);    // sets up an appendable matrix of all zeros 
temp = 0;      //initiates a temporary integer variable 
while n > 1, 
    temp = p(n)*pdf(n);  //assigns a value to the temp variable every pass 
    Psw(n) = temp;   //assigns the temp value to the nth slot in the 
          //column vector, works through the matrix backwards 
    n = n-1;    //iterates the while loop on n 
end      //breaks from while loop after n hits 1 

R(i) = sum(Psw)  
DeltaMu(i) = mu       

end 

n = 200; 
while n > 1, 
    Total(n) = WBR(n) + R(n); 
    n = n-1; 
end 

xdel(winsid());       //close any open graphs 
plot3d(WBR, R, Total)  

ответ

1

Чтобы построить поверхность с Plot3D, вам необходимо:

  • вектор х значений
  • вектор у значений
  • матрица из Z-значений, где (i, j) будет определять высоту над точкой (x (i), y (j))

Пример игрушки:

plot3d([1 2 3], [2 3 4], [0 1 2; 2 3 2; 0 2 1]) 

plot

Там нет математически разумно сделать поверхность участок из трех колонок векторов. Что вы можете сделать с ними сделать параметрическую кривую, которая использует три вектора для х, у, координаты г:

param3d(WBR, R, Total) 

С вашими данными, результат по-прежнему незахватывающий из-за высокого динамического диапазона с массивами. Рассмотрим построение графика по логарифмической шкале.

Смежные вопросы