Trying to plot summation based sine signal
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Torsten
2022년 10월 23일
편집: Torsten
2022년 10월 23일
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)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!