# How to use Manipulate in filter design to plot the sum two raised-cosines?

I would like to be able to add a raised cosine to a "standard" raised cosine. With a time delay which I could manipulate (so the shape of the standard cosine function is altered, meaning the function becomes like the image below or a reversed example of this. (But above y=0)). I do however have one limitation and that is that after a period of 0.3 seconds it should be just a baseline.

The standard cosine is:0.05 + Piecewise[{{3.95 (1 - Cos[2 Pi Mod[t, 1]/0.3])/2, Mod[t, 1] < 0.3}}]

I've tried a Module but seem to get stuck

    Manipulatedelastance[t0_, t1_, tdelay_, period_] := Module[{},

Originalfunc =
0.05 + Piecewise[{{3.95 (1 - Cos[2 Pi Mod[t, 1]/0.3])/2,
Mod[t, 1] < 0.3}}];
ToBeAddedfunction = 3.95 (1 - Cos[2 Pi Mod[t - tdelay, 1]/period])/2;
Combinedfunction =
0.05 + Piecewise[{{(((3.95)*(1 - Cos[2 Pi Mod[t, 1]/period])/2) +
EVLtr2)/2, Mod[t, 1] < 0.3}}];

EATtr =
0.17 + Piecewise[{{0.73 (1 - Cos[2 Pi Mod[t - 0.9, 1]/0.1])/2,
Mod[t, 1] > 0.9}}];
EPATtr =
0.2 + Piecewise[{{0.5 (1 - Cos[2 Pi Mod[t - 0.9, 1]/0.1])/2,
Mod[t, 1] > 0.9}}];
EPVLtr =
0.08 + Piecewise[{{3.95/5 (1 - Cos[(2 Pi Mod[t, 1]/0.3)])/2,
Mod[t, 1] < 0.3}}];

{Plot[Originalfunc, {t, t0, t1}],
t1}, PlotRange -> All,
"Combinedfunction"}],
Plot[{Originalfunc, EATtr, EPATtr, EPVLtr, Combinedfunction}, {t,
t0, t1}, PlotRange -> All,
PlotLegends -> {"EVL", "EAT", "EPAT", "EPVL", "Enew"}]}]

Manipulate[
Manipulatedelastance[t0, t1, tdelay, period], {{t0, 0}, 0,
30}, {{t1, 2}, 0, 20}, {{tdelay, 0.7}, 0, 1}, {{period, 0.3}, 0, 1}]


I know this is probably not the best explanation of all but I would really appreciated if somebody could help.

Thank you very much in advance!

If I understand what you are wanting to do, then try something like this,

OriginalFn[t_] := 0.05 + 3.95 Piecewise[{{1/2 (1 - Cos[2 Pi Mod[t, 1]/0.3]), Mod[t, 1] < 0.3}}]

ToBeAddedFn[t_, delay_, period_, amplitude_] := amplitude *
Piecewise[{
{1/2 (1 - Cos[2 Pi Mod[t - delay, 1]/period]), Mod[t - delay, 1] < period}
}]

Manipulate[
Row[{
Plot[{OriginalFn[t], ToBeAddedFn[t, delay, period, amplitude]}, {t, 0, 0.4}, PlotRange -> {0.0, 4}, ImageSize -> 300],
Plot[1/2 (OriginalFn[t] + ToBeAddedFn[t, delay, period, amplitude]), {t, 0, 0.4}, PlotRange -> All, ImageSize -> 300]
}],
{{period, 0.2}, 0.015, 0.3},
{{delay, 0.003}, 0, 0.3 - period},
{{amplitude, 1.97}, 0, 8}]


The above code generates the following,