필터 지우기
필터 지우기

How to plot the equations

조회 수: 9 (최근 30일)
ting po chun
ting po chun 2023년 2월 16일
댓글: Anurag Ojha 2023년 2월 17일
Hi:
I want to plot the equations such as the following screenshot. The have two different series (j & i), Thanks!!
  댓글 수: 2
Luca Ferro
Luca Ferro 2023년 2월 16일
could you add some more context?
such as the value of the constants, what is j and what is i,...
ting po chun
ting po chun 2023년 2월 16일
Hi :
I am sorry without many details. The fm = c / 2d 、d=0.02、(ωm = 2πfm / fs )、fs=44100、(ω = c*k)、k is a vector of sound wave arrival。
i is the order , 1、2、3..... and the j is the complex number.
Thank you !!!!

댓글을 달려면 로그인하십시오.

답변 (2개)

Oguz Kaan Hancioglu
Oguz Kaan Hancioglu 2023년 2월 16일
You can plot using symblic toolbox. As @Luca Ferro mentioned you need to specify more information.
I created a short example for you. After defining symbolic variable, you can plot using fplot command. However, flpot just only draw one symbolic variable. You can enter frequency range as a second argument to fplot.
syms w
i = 1; j = 1; fs= 1; d = 1;
secondEq = (2*j)^(-i)*sin(pi*w*fs*d)
secondEq = 
fplot(secondEq,[-pi,pi])
  댓글 수: 1
ting po chun
ting po chun 2023년 2월 17일
Thank for your explanation!

댓글을 달려면 로그인하십시오.


Anurag Ojha
Anurag Ojha 2023년 2월 16일
As per my understanding, you are facing an issue in plotting the graph for the equation. Kindly store the output in an array according to the condition and then plot using plot()” function.
For example, if I take the equation on similar lines as your equation and taking a assumption that fs,G and d are constants say,
fs = 10;
d = 5;
G = 20;
C = fs*d;
% Now let
wm = 10;
% for w < wm
% Y = min(2*G,sin(c*w));
% Else
% Y = sin(c*w);
% So simply you could do it like this.Create an array to store result
y = [];
%storing values according to condition in an array
for w = linspace(1, wm, 10)
y(w) = min(2*G,sin(C*w)^-1);
end
for w = linspace(wm + 1, 20, 10)
y(w) = sin(C*wm)^-1;
end
%plot it against time stamps
plot(linspace(1, 10, 20), y);
So you can get your plot like this.To explore more about plot function, loops and conditional statements go through the link attached below:
Hope it helps!
  댓글 수: 2
ting po chun
ting po chun 2023년 2월 17일
Thank for your help.
I like to ask more. If i want to X become to frequency range of a audio wav file as the picture. The code how to do ?
Thank you !!!
Anurag Ojha
Anurag Ojha 2023년 2월 17일
You can refer to this MATLAB documentation to know how to plot a audio file
Hope it helps!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by