Plotting the tone frequencies

I am in the process of creating sound. I've created the tone frequencies, but I'll need to show it on a diagram (ex. plot), but it keep giving me error, when using the:
plot(s1+s2);
What am I doing wrong?
The two first plots doesn't give any results, it's just blue.
figure
subplot(3,1,1);
plot(t, s1);
xlim([0 1E+3]);
grid
subplot(3,1,2);
plot(t, s2);
xlim([0 1E+3]);
grid
subplot(3,1,3);
plot(t, s1 + s2);
xlim([0 1E+3]);
grid

2 comentarios

Cris LaPierre
Cris LaPierre el 4 de Oct. de 2020
It's always helpful to share the full error message as well.
When I run the code you shared with the plot command at the end, it generates a warning, but the plot appears. Is that what you see?
Anonym
Anonym el 4 de Oct. de 2020
Editada: Anonym el 4 de Oct. de 2020
Updated the thread.
Yes sorry, I meant there wasn't something inside the plot, when the window pop-up. It was only blue inside.

Iniciar sesión para comentar.

 Respuesta aceptada

Star Strider
Star Strider el 4 de Oct. de 2020

0 votos

Note that ‘t’ seems to be missing.
Substituting for it and changing the xlim parameters:
t = values;
figure
subplot(3,1,1);
plot(t, s1);
xlim([0 1E-1]);
grid
subplot(3,1,2);
plot(t, s2);
xlim([0 1E-1]);
grid
subplot(3,1,3);
plot(t, s1 + s2);
xlim([0 1E-1]);
grid
appears to create two separate tones and a modulated summation.
It is necessary to ‘zoom’ the plots this way in order to see the details.

13 comentarios

Anonym
Anonym el 4 de Oct. de 2020
Yeah, I had it but used the linspace function.
Anonym
Anonym el 4 de Oct. de 2020
Thanks, got it working, makes much more sense now;)
Star Strider
Star Strider el 4 de Oct. de 2020
As always, my pleasure!
Anonym
Anonym el 4 de Oct. de 2020
Editada: Anonym el 4 de Oct. de 2020
Sorry for disturbing again :-) I have a question that might be not be related to this topic, not sure but I'll give it a go. I have another question, how should I examine how the distance depends on tonevolume, how can I utilize this to create a consistent voix céleste effect in a tone with an overtone profile (harmonic profile), and implementing a scale with voix céleste effect? Any idea, what I could say about that?
Star Strider
Star Strider el 4 de Oct. de 2020
I had to look up voix céleste.
I honestly have no idea. You will have to experiment to get the result you want.
Anonym
Anonym el 11 de Oct. de 2020
Yeah, thanks alot. Figured it out, found out it was kind of the same as the beateffect :-)
I'd like to ask you, if you could help me to plot the two frequencies in one plot? So it'll be combined, will show both graph in the same plot. I tried to use the examples the person did, but couldn't it gave me a blank figure window (https://se.mathworks.com/help/matlab/creating_plots/combine-multiple-plots.html)
I tried the following, but couldn't get it to work.
figure
plot(values, s1);
hold on
plot(values, s2);
grid
hold off
Star Strider
Star Strider el 11 de Oct. de 2020
I am not certain what the problem is. If you are using ‘t’ as the independent variable (as in your initial post), try this:
figure
plot(t, s1);
hold on
plot(t, s2);
grid
hold off
.
Anonym
Anonym el 13 de Oct. de 2020
Thanks, got it working. Sorry for keep disturbing you, but could you help me with adding a header function, tried multiple ways: https://se.mathworks.com/matlabcentral/answers/612961-adding-header-function-to-two-frequencies
Star Strider
Star Strider el 13 de Oct. de 2020
I do not understand what you mean by ‘header function’.
What is it supposed to do?
Anonym
Anonym el 13 de Oct. de 2020
It's declaring function name: https://se.mathworks.com/help/matlab/ref/function.html
Star Strider
Star Strider el 13 de Oct. de 2020
I posted an Answer to it.
Anonym
Anonym el 7 de Dic. de 2020
Hello, sorry for always disturbing you. Do not know who else I could ask. There is just one thing I am curious about regarding this; is that how can I analyze a graph a two-tone frequencies that are combined in a graph? By your help and using your assistance, I have created two pairs of two frequencies with a close frequency and one with two frequencies that are far apart from each other. There is a clear difference, but how can we analyze it directly from the graph?
Appreciating your help.
Star Strider
Star Strider el 7 de Dic. de 2020
No worries.
I posted a sort-of Answer to it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Audio Processing Algorithm Design en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 4 de Oct. de 2020

Comentada:

el 7 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by