Hello, I want to plot function of sound wave
y=A1sinh(2pift)^2-1.Asin(2pift)
The code that I have written is given below
clc;
clear all;
close all;
fs=2400; %sampling frequencyy=
f1=0.5; %frequency of the sound wave
f2=200;
A1=1
A2=1
t=0:10/fs:1;
y=((A1*sinh(2*pi*f1*t).^2)-1).*(A2*sin(2*pi*f2*t));
plot(t,y)
sound(y);

4 commentaires

KSSV
KSSV le 5 Juin 2022
It is working right? What question you have specifically?
BASIT ALI
BASIT ALI le 5 Juin 2022
it is working, but sound is not produced .
Plot is right that I want to obtain , but sound is not produced.
Dyuman Joshi
Dyuman Joshi le 5 Juin 2022
I checked the code on my laptop, the code runs fine and it produces a sound as well, but just a short beep.
(Increase your sampling frequency to get a longer sound or use earphones to hear the sound)
BASIT ALI
BASIT ALI le 6 Juin 2022
Thanks alot...

Connectez-vous pour commenter.

 Réponse acceptée

Image Analyst
Image Analyst le 5 Juin 2022
Modifié(e) : Image Analyst le 5 Juin 2022

0 votes

Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
markerSize = 30;
fprintf('Beginning to run %s.m ...\n', mfilename);
Beginning to run LiveEditorEvaluationHelperEeditorId.m ...
fs=2400; % sampling frequency
f1=0.085; % frequency of the sound wave
f2=200;
A1=1;
A2=1;
t = 0 : 1/fs : 5;
y=((A1*sinh(2*pi*f1*t).^2)-1).*(A2*sin(2*pi*f2*t));
plot(t,y)
grid on;
xlabel('Time', 'FontSize',fontSize)
ylabel('Signal', 'FontSize',fontSize)
drawnow;
soundsc(y);
I'm also attaching an old demo of mine.

Plus de réponses (0)

Catégories

En savoir plus sur Animation dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by