problem with matlab index

hi
i'm rajashekar from JNTU doing my M.tech
i have been trying to solve an equation and it requires me repaet this equation in a loop and store values . the equation is
I(n*td) = sin(((alpha(n)./2)) + (((beta./2)).*(I((n-1)*td)))).^2;
here n is an integer but td is in micro or milli seconds and matlab does not allow for storing n*td that gives a decimal values. is there any way i can save my iteration results in a matrix?
thank you

Risposte (1)

Walter Roberson
Walter Roberson il 28 Gen 2012
Your only use of td is to multiply the index in to I. So unless there are reasons not to, just leave td out:
I = zeros(FinalValueIndex,1);
I(1) = TheInitialValue;
for n = 2 : FinalValueIndex
I(n) = sin(alpha(n)./2) + (beta ./2 .* I(n-1)).^2;
end
Unless, that is, beta is a vector.

3 Commenti

rajashekar
rajashekar il 30 Gen 2012
yes i was doing so too....but the more i think about it i thought i might be wrong....because theoretically td is the time delay and the index there is the time....so i basically should multiply time and time delay....time can be integer but delay is in micro seconds...i should multiply both and repeat the iteration....beta is constant...can you explain if i use above code you told me how is the delay introduced into the code which i'm really confused about....
rajashekar
rajashekar il 30 Gen 2012
also my original equation which i have to simulate is
I(t)=sin(((alpha(t)./2)) + (((beta./2)).*(I((t-td)))).^2;
where t is time and td is time delay....can you tell me how do i simulate this?
rajashekar
rajashekar il 31 Gen 2012
any ideas?

Accedi per commentare.

Richiesto:

il 28 Gen 2012

Community Treasure Hunt

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

Start Hunting!

Translated by