How do I change the scale for x-axis???

5 ビュー (過去 30 日間)
Alex Phang
Alex Phang 2017 年 12 月 25 日
コメント済み: Alex Phang 2017 年 12 月 26 日
p_avg=1; % average optical power
R=1; % photodetector sensitivity
Rb=1; % normalized bit rate
Tb=1/Rb; % bit duration
df=Rb/100; % spectral resolution
f=0:df:5*Rb; % frequency vector
x=f*Tb; % normalized frequency
temp1=(sinc(x)).^2;
a=R*p_avg;
p=(a^2*Tb).*temp1;
%p(1)=p(1)+((a^2)*Tb)*(sinc(0)^2)*(1/Tb); % delta function at DC
p=p/(((p_avg*R)^2)*Tb); % power normalization by energy per bit
plot(p)
The graph is plot as:
But the graph I should get is:
So, which parameter should I change in order to get the correct scale for x-axis?
  2 件のコメント
help_me
help_me 2017 年 12 月 25 日
I'd try something along the line of
axis ([0 4 0 1]);
Let me know if it works.
Best of luck
Alex Phang
Alex Phang 2017 年 12 月 26 日
Nope, it still wrong.

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

採用された回答

Birdman
Birdman 2017 年 12 月 26 日
p_avg=1; % average optical power
R=1; % photodetector sensitivity
Rb=1; % normalized bit rate
Tb=1/Rb; % bit duration
df=Rb/100; % spectral resolution
f=0:df:5*Rb; % frequency vector
x=f*Tb; % normalized frequency
temp1=(sinc(x)).^2;
a=R*p_avg;
p=(a^2*Tb).*temp1;
%p(1)=p(1)+((a^2)*Tb)*(sinc(0)^2)*(1/Tb); % delta function at DC
p=p/(((p_avg*R)^2)*Tb); % power normalization by energy per bit
plot(f/Rb,p)
set(gca,'XLim',[0 4]);
set(gca,'YLim',[0 1]);
set(gca,'XTick',[0 1 2 3])
  3 件のコメント
Birdman
Birdman 2017 年 12 月 26 日
xlabel('sth');
ylabel('sth');
Alex Phang
Alex Phang 2017 年 12 月 26 日
What about the line styles? Just like the second graph but now my graph get just like this:

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by