![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1463002/image.jpeg)
Gaussian-modulated function for Temperature definition
4 次查看(过去 30 天)
显示 更早的评论
I am trying to implement a code that describes the temperature distribution at the wall (T_wall in input) with a function of the type shown in the attachment (first section equal to Tamb, central section with a Gaussian and final section again with Tamb).
I don't understand how to modify the syntax reported for the gauspuls command with the correct frequency and bandwidth, as showed in the following code.
Tamb = 293;
Tmax = Tamb+200; % peak amplitude for temperature distribution
% t = linspace(0,300); time interval 5 min
t0 = Tamb*ones(1,19);
t1 = [20:100]; % time interval for gaussian T_wall
t2 = Tamb*ones(1,200);
t = [t0 t1 t2]; % time interval definition
%tc = gauspuls('cutoff',50e3,0.6);
%t = -tc : 1e-7 : tc;
%[yi,yq,ye] = gauspuls(t,50e3,0.6);
%plot(t,ye)
%legend('Envelope');
[yi,yq,ye] = gauspuls(t,50e3,0.6);
figure(1)
plot(t,ye)
xlabel('t [s]')
ylabel('Wall Temperature [K]')
title('Wall Temperature as a gaussian function')
legend('Wall Temperature')
Thanks in advance, if someone can help me.
0 个评论
回答(1 个)
Ayush Aniket
2023-8-23
I understand you are trying to plot the graph as attached in your question. For plotting the sinusoidal part of the plot you are trying to use ‘gauspuls’ function of MATLAB. However, based on the image, I think it will not be suitable for your case as ‘gauspuls’ command plots a unit-amplitude Gaussian-modulated sinusoidal RF pulse which will have decaying amplitude for each of period of the sine wave. In the image the sinusoidal portion has 4 pulses with equal amplitude. Hence, I suggest you to use a squared sinusoidal wave for your plot as shown below:
Tamb = 293; % Ambient temperature
Tmax = Tamb + 200; % Maximum temperature at the peak
t0 = 1:19; % Initial section with ambient temperature
t1 = 20:100; % Time interval for the Gaussian section
t2 = 101:200; % Final section with ambient temperature
t = [t0 t1 t2]
F = 1 / 40 % as each sine wave has a period of 40s(before squaring)
y = Tamb + (Tmax -Tamb) * sin(2 * pi *F*t ).^2
Y = [Tamb*ones(1,numel(t0)), y(t1), Tamb*ones(1,numel(t2))]
plot(t,Y)
xlabel('t[s]')
ylabel('Wall Temperature [K]')
yticks([Tamb,Tmax]);
yticklabels({'Tamb','Tmax'});
xticks([20,100]);
xticklabels({'20','100'});
title('Wall Temperature as a gaussian function')
legend('Wall Temperature')
This produces the following plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1463002/image.jpeg)
Hope it helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!