
steady plot end with different rate of rise question
Show older comments
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;

Answers (2)
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?
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;
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!