Trying to plot summation based sine signal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am generating a random signal based on summation.
Here is the code:
clear all
clc
format long
syms x u
L = 2*pi;
s = rand;
si = L*s;
G5_6 = gamma(5/6); G1_3 = gamma(1/3); k_di = 10000/35;
C = (55/9)*(G5_6/(sqrt(pi)*G1_3));
sigma = 2; ke = 5; l = (2*pi)/5;
n = 1; N=10; u = 0; eta = l/(10^4);
nke = n/ke; k_eta = (2*pi)/eta;
sigma_n = k_eta/10; a_n = 0;
for i = n:N
E_vk = C*((sigma^2)/ke)*((nke)^4)/((1+nke^2)^(17/6));
E_n = E_vk*exp((-(n-k_di)^2)/(sigma_n^2));
a_n = ((2*E_n)^(1/2)) + a_n;
u = (a_n*sin(n*x+si) + u);
end
u
Now, I want to plot u on y-axis against x on x-axis that goes from 0 to 10*pi
I have tried a few things but nothing works, please help
0 Kommentare
Akzeptierte Antwort
Torsten
am 23 Okt. 2022
Bearbeitet: Torsten
am 23 Okt. 2022
syms x
L = 2*pi;
s = rand;
si = L*s;
G5_6 = gamma(5/6); G1_3 = gamma(1/3); k_di = 10000/35;
C = (55/9)*(G5_6/(sqrt(pi)*G1_3));
sigma = 2; ke = 5; l = (2*pi)/5;
n = 1; N=10; u = 0; eta = l/(10^4);
nke = n/ke; k_eta = (2*pi)/eta;
sigma_n = k_eta/10; a_n = 0;
for i = n:N
E_vk = C*((sigma^2)/ke)*((nke)^4)/((1+nke^2)^(17/6));
E_n = E_vk*exp((-(n-k_di)^2)/(sigma_n^2));
a_n = ((2*E_n)^(1/2)) + a_n;
u = (a_n*sin(n*x+si) + u);
end
xnum = linspace(0,10*pi,1000);
unum = subs(u,x,xnum);
plot(xnum,unum)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Particle & Nuclear Physics 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!