how can I sum 2 or more sine waves into one sine wave?
28 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Khuram
el 6 de Abr. de 2015
Comentada: Khuram
el 6 de Abr. de 2015
I have 2 questions: 1: How can I sum two or more sine waves into one sine wave? as the example shown below
2: The code below suppose to give only 3 sine waves and the I have to sum them, I don't know how can remove the forth line and then sum the other 3?
Thank you in advance for helping
clc;clear
k=0.5;
rho=1600;cv=725;aLf=k/(rho*cv);
day=1;L=0.4;
nx=5; nxp=nx+1; dx=L/nx;nxx=dx*(1:nxp);
td=day*24*3600;nt=60;ntp=nt+1;dt=td/nt;
%--------------------------------------------------------------------------
Tem=[4 4 4 3 3 3 3 4 5 6 7 8 9 10 10 10 10 9 8 7 7 6 5 4];
x=(1:(24*day))*3600;
f = fit(x.',Tem.','fourier2');
coeffs = coeffvalues(f);
w=coeffs(:,6);
%--------------------------------------------------------------------------
Ti=10;
t=linspace(0,td,ntp);x=linspace(0,L,nxp);
T=zeros(1,ntp);depth=0.1;
for h=1:2:5;
Ts(h)=coeffs(:,h);
if h>3
a=2;
else
a=1;
end
for j=1:ntp
time(j)= (j)*dt;
Tx=Ti+(Ts(h)*(exp(-(sqrt(w/(2*aLf))*depth))))*(sin(a*w*time(j)-((sqrt(w/(2*aLf))*depth))));
T(j)=Tx;
end
TM(h,:)= T;
end
plot(t/3600,TM,'linewidth',2); hold on; xlabel('time (t)'); ylabel('Surface Temperature(Ts)');grid on
0 comentarios
Respuesta aceptada
michael scheinfeild
el 6 de Abr. de 2015
just z=x+y if x and y different lengths you can interpolate it to correct length
Más respuestas (1)
Ver también
Categorías
Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!