Graph gets cut-off when adding a new graph

Hello,
I try make a plot with different graphs. The first 5 graphs are constants. The 6th graph is of form of 1/x^2 which should increase exponentially when approaching zero. But at 1*10^-6 sharp it gets cut and the exponentially growing part below 1*10^-6 does not show. How can I prevent, getting exponential increasing plots not cut off? I tried also different varieties of hold on/off and nothing worked. You will find the result attached. Thanks for your help!
Code:
ax = gca; % get the current axis
ax.Clipping = 'off'; % turn clipping off
x=0:0.0000001:0.000002;
tiledlayout(1,1)
ax1 = nexttile;
hold(ax1,'on');
y6=torque_force_05T*(ones(1,length(x))); %blue constant
plot(ax1,x,y6);
y7=torque_force_04T*(ones(1,length(x))); %orange constant
plot(ax1,x,y7);
y8=torque_force_03T*(ones(1,length(x)));%yellow constant
plot(ax1,x,y8);
y9=torque_force_02T*(ones(1,length(x))); %purple constant
plot(ax1,x,y9);
y10=torque_force_01T*(ones(1,length(x))); %green constant
plot(ax1,x,y10);
y1=mu_dynamic*(((Kw*(1000*q)*(1000*q))./(x.^2))+torque_force_05T); %red exponential fuction which gets cut off at 1
plot(ax1,x,y1,'-r')
hold(ax1,'off')

2 个评论

The first hold on causes the symptom by holding the first xy limits when you add the other curves.
Two ways to fix it --
  1. Set the y axis limits as wanted with ylim when done, or
  2. Plot the y1 values first before hold on, and then use hold on to keep them.
Thanks for your help! But the problem was the x=0:0.0000001:0.000002;. The first point for y6-y10 was the intermediate step of 0.0000001. That is why it was cut off at the step.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Networks 的更多信息

产品

版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by