Trying to plot summation based sine signal

1 visualización (últimos 30 días)
Saim
Saim el 23 de Oct. de 2022
Comentada: Saim el 23 de Oct. de 2022
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

Respuesta aceptada

Torsten
Torsten el 23 de Oct. de 2022
Editada: Torsten el 23 de Oct. de 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)

Más respuestas (0)

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by