フィルターのクリア

how to set the amplitude of the exponential sequence to 1

3 ビュー (過去 30 日間)
ahmad ramadan
ahmad ramadan 2018 年 11 月 2 日
編集済み: madhan ravi 2018 年 11 月 2 日
i have this code how to make the maximum amplitude to be 1
my code
N=1000; %Number of samples A=1; t=0:100:N; x=A*exp(t); figure(1) plot(t,x);

回答 (2 件)

Stephan
Stephan 2018 年 11 月 2 日
編集済み: Stephan 2018 年 11 月 2 日
Hi,
you could use a normalization like:
N=10; %Number of samples
A=0.0001;
t=0:0.1:N;
x=A.*exp(t);
x1 = x./max(x);
figure(1)
plot(t,x,t,x1);
grid on
I changed your values a bit, because your code produces numbers too big to handle for Matlab and due to this become Inf - in this example you see the difference between the normalized one (red) and the original (blue).
Best regards
Stephan
  2 件のコメント
ahmad ramadan
ahmad ramadan 2018 年 11 月 2 日
i asked to produce huge number of sample
Stephan
Stephan 2018 年 11 月 2 日
編集済み: Stephan 2018 年 11 月 2 日
could you explain a little more please? The number of samples is given by this line:
t=0:0.1:N; % sampling rate = 10
for N=10 and 0.1 it will have 101 samples (0 is also a sample, so you get 100+1). But if you take huge values for N you produce incredibly huge numbers (this is math - you cant change this fact...). So the second way to get many samples is to make a smaller step size which is the same as increase the sampling rate to a higher frequency. If you use:
t=0:0.001:N; % sampling rate = 1000
you will get a big number of samples, but with values that are possible to handle for 64 bit machines.
It is important to understand that N is not the number of samples - if you want to know the number of samples use:
numel(t)

サインインしてコメントする。


madhan ravi
madhan ravi 2018 年 11 月 2 日
編集済み: madhan ravi 2018 年 11 月 2 日
maybe you are looking for exponential decay:
N=1000;
A=1;
t=0:100:N;
x=A*exp(-t);
figure(1)
plot(t,x);
  2 件のコメント
Stephan
Stephan 2018 年 11 月 2 日
編集済み: Stephan 2018 年 11 月 2 日
This gives exactly 11 samples. The OP has to understand that the number of samples is not defined by N, but by the value in
num_samples = 1000;
t = 0:(1/num_samples):N
madhan ravi
madhan ravi 2018 年 11 月 2 日
exactly @stephen missed that part

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by