how to store every value that i get from each iteration of for loop ?

3 Ansichten (letzte 30 Tage)
i want to store all values of an but my code has some error ,plz remove it
clc
clear all
k=1
f=2
t=rand(1,1000)
for i=1:100:1
for p=1:100:1
an(i,p)=(sin(2*3.14*(2*k-1)*f*t(i,p)))/(2*k-1);
end
end
plot(t,an)
here
i want to store every value of this function
an(i,p)=(sin(2*3.14*(2*k-1)*f*t(i,p)))/(2*k-1);
so that i can plot it at the end

Akzeptierte Antwort

Torsten
Torsten am 17 Sep. 2022
Bearbeitet: Torsten am 17 Sep. 2022
k=1
f=2
t=rand(100);
an = sin(2*pi*(2*k-1)*f*t)/(2*k-1);

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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