indexing - Matlab. I got some errors -


l_0=1.5;  l_1=1.6;   lambda_min=2*(1+1)*l_0;  lambda_max=2*(1+1)*l_1;  n_0=linspace(2,2.11,10); n_1=linspace(2.30,2.50,10); i=1:10    j=1:10    k=1:10     l(i) = lambda_min * ( lambda_max/lambda_min)^(i/10)      sum=sum(l)     d_0(:,j)= l(i)/((n_0(i)/n_1(i)+1))                     d_1(:,k)= (n_0(i)/n_1(i))*d_0(:,j)        end    end  end 

first of all; want find values of l(i) vector, take sum of vector. second, d_0(:,j) want create matrix can plot later, takes different values l(i),n_0,n_1 each time. if take values n_0 , n_1 , put in loop index error because should logic or integer number.

my matrix overwritten , not know how avoid it. note, want in d_0 , d_1 n_0 , n_1 take values linspace. example in first iteration n_0= 2 n_1= 2.30 second iteration take next value in linspace.

i tried see value of n_0(i) , give me 10 iterations. gives me more that overwritten.

try:

l_0=1.5;  l_1=1.6;   lambda_min = 4*l_0;  lambda_max = 4*l_1;   n_0 = linspace(2,2.11,10) % don't add semicolon can check giving 10 values n_1 = linspace(2.30,2.50,10) %  i=1:10       l(i) = lambda_min * ( lambda_max/lambda_min)^(i/10) % should give 10 values  end   d_0= l./((n_0./n_1+1)); % give vector, not matrix.                 d_1= (n_0./n_1).*d_0;     lsum = sum(l); % should give 1 value 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -