## I want to convert a piece of violin that I heard on YouTube into a waveform (amplitude as a function of time or frequency)

I want to convert a piece of violin that I heard on YouTube into a waveform (amplitude as a function of time or frequency). How to do this with Mathematica, please? I suspect it may have something to do with processing a MIDI file. That’s all I know.

Posted on

## tracing – Amplitude and phase of a periodic signal (Fourier series)

``````ClearAll(f, t, w0, w, fs)
f(t_, w0_) := Cos(w0 t) + 3 Sin(2 w0 t) + 5 Cos(6 w0 t);

(*using w0=1 as example. Change as needed*)
fs = FourierTransform(f(t, 1), t, w, FourierParameters -> {1, -1});

mag = ComplexExpand@Abs(fs);
tab = Table({k, mag /. w -> k}, {k, -6, 6});
tab = tab /. DiracDelta(0) -> 1;
ListPlot(tab, Filling -> Axis, FillingStyle -> {Thick, Red},
AxesLabel -> {"w (r/s)", "Amplitude"}, BaseStyle -> 12,
GridLines -> Automatic, GridLinesStyle -> LightGray)
`````` ``````phase = ComplexExpand@Arg(fs);
tab = Table({k, phase /. w -> k}, {k, -6, 6});
tab = tab /. DiracDelta(0) -> 1;
ListPlot(tab, Filling -> Axis, FillingStyle -> {Thick, Red},
AxesLabel -> {"w (r/s)", "Phase"}, BaseStyle -> 12,
GridLines -> Automatic, GridLinesStyle -> LightGray)
`````` Posted on

## plotting – how to plot the amplitude and phase spectrum of a Fourier transform in this specific pattern?

I will show the easy way, then the difficult way.

## Easy way

Since the Fourier transform is the Laplace transform when it is real of `s` sucks you can use `BodePlot`

``````ft = FourierTransform(Exp(-a t) UnitStep(t), t, w, FourierParameters -> {1, -1});
`````` ``````ft = ft /. (I*w) -> s
`````` ``````BodePlot(TransferFunctionModel((ft /. a -> 1), s))
`````` You can improve the plot like this

``````ft = FourierTransform(Exp(-a t) UnitStep(t), t, w, FourierParameters -> {1, -1})
ft = ft /. (I*w) -> s
tf = TransferFunctionModel((ft /. a -> 1), s);
BodePlot(tf, GridLines -> Automatic, ImageSize -> 400,
FrameLabel -> {{{"magnitude (db)", None}, {None, "Bode plot"}},
ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}},
BaseStyle -> 14)
`````` ## Hard way

``````ft = FourierTransform(Exp(-a t) UnitStep(t), t, w, FourierParameters -> {1, -1});
LogLinearPlot(20*Log10(Abs((ft /. a -> 1))), {w, 0, 10})
`````` `````` LogLinearPlot(Arg((ft /. a -> 1))*180/Pi, {w, 0, 10})
`````` Here is a Handle

``````Manipulate(
Module({ft, t, s, w, tf, a0},
ft = FourierTransform(Exp(-a0 t) UnitStep(t), t, w,
FourierParameters -> {1, -1});
ft = ft /. (I*w) -> s;
tf = TransferFunctionModel((ft /. a0 -> a), s);
BodePlot(tf, GridLines -> Automatic, ImageSize -> 400,
FrameLabel -> {{{"magnitude (db)", None}, {None, "Bode plot"}},
ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}},
BaseStyle -> 14)
),
{{a, 1, "a"}, .1, 10, .1, Appearance -> "Labeled"},
ContinuousAction -> False,
TrackedSymbols :> {a}
)
`````` Posted on

## Fourier analysis – Spectrum of harmonic amplitude

I have simulated an electric machine in mathematica in discrete calculus. One of the results is three-phase currents. My answer is as follows: Now, I'm looking for the harmonic amplitude spectrum of the current of one of the phases, for example phase A as in the following figure: I must mention that, as all my simulations are in discrete computation, the current phase response is a vector like:

``````ia = {0, 0., -0.548775, <<14995>>, 11.4906, 10.9900, 11.1094}
``````

Posted on

## If \$ f (x) = sin ^ 4 (6x) + cos ^ 4 (6x) \$ is a sine wave, look for amplitude, phase, and period.

Yes $$f (x) = sin ^ 4 (6x) + cos ^ 4 (6x)$$ is a sine wave, find the amplitude, phase and period.

I do not know how to work with $$sin ^ 4$$ and $$cos ^ 4$$I tried to use the formula, but it does not work because of the $$4$$e degree. Allusions?

## Differential Equations – Finding the Amplitude of a Function Resolved Using ParametricNDSolve

I've tried to find the vertices of a function I've traced with ParametricNDSolve. I have to find these peaks to calculate the amplitude of all the different waves in the observed output. By amplitude, I mean the difference between an adjacent ridge and trough. I will join the program here to clarify the problem.

``````Clear["Global`*"]
om = 1;
k = 1;
L = 1/1000;
P = 1.3;

eqns = {a & # 39;
I * ((de / om) * a
1/2) - (k / (2 * om)) * a
b & # 39;
b == 0, a == 0};

s = ParametricNDSolve[eqns, {a, b}, {t, 0, 100}, de,
MaxSteps -> [Infinity]];

X[de_][t_]    = (b[de]

Manipulate[
Ground[X[x[X[x[de]
Appearance -> "Labeled"}]
``````

Now, I have to find the value of the amplitude of x for each value of that I have plotted. Although I was able to find the peaks for the individual values ​​of de and a single peak for these values, I am unable to find all the peaks and amplitudes for all the values ​​of de. I've used various functions, including FindPeaks[] to try to find such values ​​but was not able to do so. Normally, I would have used loops, but this seems to be inadvisable in Mathematica. I would also like to know if such a code would be too heavy and if I use brute force to find such values.

I would be very grateful to anyone who could help me solve this dilemma. I would like to thank you for it in advance

Posted on

## Obtain the amplitude estimates A of the real Fouriercoefficient Cmu komplex Fouriercoefficient

We have a Cmu function. The first possibility is to get the abdominals (Cmu) and display them. But in this task, we should get the amplitudes of the real Fourier coefficient of the given Cmu.
What is the best way to solve it?

Posted on

## java – Finding the largest amplitude in a table

My mission is to determine which season has the greatest temperature range. Input by is the int array with temperatures:

int T[]= {-1, -10,10,5,30,15,20, -10,30,10,29,20} and this gives:

winter: -1, -10,10 spring: 5,30,15 summer: 20, -10,30 autumn: 10,29,20

• temp is always and int,
• int[] T – T.length% 4 is equal to 0 (the same number of temperatures for each season, could be 2, 3 etc.)

{

``````public channel solution (int[] T) {
int long = T.length;
int account = length / 4;
int i = 0, j = 0, indx = 0;
String name = "";
int maxAmpl;

int[] winter = new int[count];
int[] spring = new int[count];
int[] summer = new int[count];
int[] autumn = new int[count];
int[] diff = new int;

for (j = 0, i = 0; j <number; j ++, i ++) {
winter[i] = T[j];
}

for (j = number, i = 0, j <number * 2, j ++, i ++) {
spring[i] = T[j];
}

for (j = number * 2, i = 0, j <number * 3, j ++, i ++) {
summer[i] = T[j];
}

for (j = number * 3, i = 0, j <number * 4, j ++, i ++) {
l & # 39; fall[i] = T[j];
}

Arrays.sort (winter);
Arrays.sort (spring);
Arrays.sort (summer);
Arrays.sort (autumn);

Diff = winter[count-1]-winter;
Diff = spring[count-1]-spring;
Diff = summer[count-1]-summer;
Diff = autumn[count-1]-l & # 39; fall;

maxAmpl = diff;

for (int k = 1; k<4; k++){
if (diff[k]>maxAmpl) {
maxAmpl = diff[k];
indx = k;
}
}

switch (indx) {
case 0:
name = "WINTER";
Pause;
case 1:
name = "SPRING";
Pause;
case 2:
name = "SUMMER";
Pause;
case 3:
name = "AUTUMN";
Pause;
}
return the name;
``````

}