steady plot end with different rate of rise question

조회 수: 7 (최근 30일)
fima v
fima v 2025년 1월 12일
답변: Image Analyst 2025년 1월 12일
Hello, in the photo below the start and end points are stable,the rate of change between them changes.
In the code below i tried to use exponential curves but different rate gives me different end point.
is there some wat the curves will start and end at the same points as shown below?
Thanks.
% Define the range of x values
x = linspace(0, 1, 10); % 0 to 1 with 100 points
% Define different rates for the exponential rise
rate1 = 10; % Faster rise
rate2 = 9.9; % Moderate rise
rate3 = 2; % Slower rise
% Compute the exponential values
y1 = exp(rate1 * x) - 1; % Exponential curve 1
y2 = exp(rate2 * x) - 1; % Exponential curve 2
y3 = exp(rate3 * x) - 1; % Exponential curve 3
% Plot the exponential curves
figure;
plot(x, y1, 'b', 'LineWidth', 1.5); hold on;
plot(x, y2, 'r', 'LineWidth', 1.5);
plot(x, y3, 'g', 'LineWidth', 1.5);
% Add labels and legend
xlabel('x-axis');
ylabel('y-axis');
legend({'Rate = 10', 'Rate = 5', 'Rate = 2'}, 'Location', 'NorthEast');
title('Exponential Rise at Different Rates');
grid on;

답변 (2개)

Paul
Paul 2025년 1월 12일
Hi fima,
The functions being plotted are of the form
syms y_i(x) r_i
disp(y_i(x) == exp(r_i*x) - 1)
Why should y_i(x) be the same for two different values of r_i for any x > 0?
  댓글 수: 4
fima v
fima v 2025년 1월 12일
"exponent like"
Paul
Paul 2025년 1월 12일
No idea what that means or what the goal actually is ...

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


Image Analyst
Image Analyst 2025년 1월 12일
Your plot shows an exponential decrease but the code you gave does an exponential increase. Which do you want?
And is it your intent to "anchor" points on the left and the right to some specified y values for all 3 curves? So that they all go through the same point on the left and same point on the right but have a different amount of "bend" in between those two points? If so you'll have to introduce another parameter - just specifying the rate alone won't do it.
% Define the range of x values
x = linspace(0, 1, 10); % 0 to 1 with 100 points
% Define different rates for the exponential rise
rate1 = 10; % Faster rise
rate2 = 9.9; % Moderate rise
rate3 = 2; % Slower rise
% Compute the exponential values
y1 = exp(rate1 * x) - 1; % Exponential curve 1
y2 = exp(rate2 * x) - 1; % Exponential curve 2
y3 = exp(rate3 * x) - 1; % Exponential curve 3
% Plot the exponential curves
figure;
plot(x, y1, 'b', 'LineWidth', 1.5); hold on;
plot(x, y2, 'r', 'LineWidth', 1.5);
plot(x, y3, 'g', 'LineWidth', 1.5);
% Add labels and legend
xlabel('x-axis');
ylabel('y-axis');
legend({'Rate = 10', 'Rate = 5', 'Rate = 2'}, 'Location', 'NorthEast');
title('Exponential Rise at Different Rates');
grid on;

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by