How to have a just specific part of a plot?

85 ビュー (過去 30 日間)
shahin sharafi
shahin sharafi 2021 年 8 月 13 日
コメント済み: shahin sharafi 2021 年 8 月 14 日
Hi
For a purpose, I am trying to have a just specific part of my plot only. For example, if you run the below code, you will get figre 1 (attached file), but I want have just part of it that has been shown in figure 2 (attached file). I dont mean about using axis function (axis([0,18000,0,2000]);). I want to eliminate other part of the plot after plotting.
Thank you in advance for you help.
Regards,
Shahin
clear all
clc
% close all
%%
m=60;L=1;J=60;g=9.81;beta2=411.67;
Time_Delayb=0.2;Time_Delaye=0.25;
tau1=Time_Delayb;tau2=Time_Delaye;
KPb=2.15;KDb=0.75;
%%
W = linspace(0, 10*pi, 1000);omega=W;
Kpe=@(omega)J.*cos(omega.*tau2).*omega.^2 - KDb.*beta2.*omega.*sin(omega.*tau1 - omega.*tau2) + L.*cos(omega.*tau2).*g.*m - KPb.*beta2.*cos(omega.*tau1 - omega.*tau2);
Kde=@(omega)(omega.^2.*J.*sin(omega.*tau2) - KDb.*beta2.*omega.*cos(omega.*tau1 - omega.*tau2) + m.*g.*L.*sin(omega.*tau2) + KPb.*beta2.*sin(omega.*tau1 - omega.*tau2))./omega;
%%
figure('DefaultAxesFontSize',10,'DefaultAxesFontName','Times')
D_Curve_PD_KPe=Kpe(omega);
D_Curve_PD_KDe=Kde(omega);
%%
plot(D_Curve_PD_KPe,D_Curve_PD_KDe,'color',[1 0.025 0.05],'LineWidth', 2)
grid on
hold on

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 8 月 13 日
編集済み: Scott MacKenzie 2021 年 8 月 13 日
Follow the plot command with...
axis([0 400 0 120]);
axis off;
set(gcf,'color','w');
Output:
  3 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 8 月 13 日
編集済み: Scott MacKenzie 2021 年 8 月 13 日
Well, in that case, I'm not really sure what you are trying to do.
Are you trying to get just a portion of the curve? If so, something like this might work, assuming you know the start and end indices of the section of the curve of interest:
% plot(D_Curve_PD_KPe,D_Curve_PD_KDe,'color',[1 0.025 0.05],'LineWidth', 2)
startIdx = 400;
endIdx = 600;
x = D_Curve_PD_KPe(startIdx:endIdx);
y = D_Curve_PD_KDe(startIdx:endIdx);
plot(x,y,'color',[1 0.025 0.05],'LineWidth', 2);
shahin sharafi
shahin sharafi 2021 年 8 月 14 日
Thank yo so much for your help .

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by