Unable to create a exponential graph

I am trying to make a basic tyre degredation model and I am not able to get an increasing exponential graph. I have four input block representing vital variables reagrding tyre degredation. The current model is down below. The code inside the MATLAB function block is
function y = exp_temp(u)
2 % Exponential function for temperature degradation
3 a = 0.1; % adjust this value to fit the data
4 b = 0.02; % adjust this value to fit the data
5 y = a * exp(b * u);
6 end
The graph should look like something In the second picture. What am I doing wrong.

回答 (2 件)

Les Beckham
Les Beckham 2024 年 9 月 10 日

0 投票

I guess I don't really see what the problem is. Follow your own comments and adjust a and b to match the expected curve.
Can you explain more clearly what the issue is?
u = 0:5;
y = exp_temp(u);
plot(u, y, 'o-')
grid on
function y = exp_temp(u)
% Exponential function for temperature degradation
a = 0.1; % adjust this value to fit the data
b = 0.2; % adjust this value to fit the data <<< I increased this by 10x
y = a * exp(b * u);
end

3 件のコメント

Rohan
Rohan 2024 年 9 月 10 日
編集済み: Rohan 2024 年 9 月 10 日
Okay my goal is to be able to model how the tyre will degrade when data for the temperature of the tyre, the avg speed of the car, the distanced traveled and the avg load on the tyre. All of these factors when put together should give an increasing exponential function as per vehicle dynamics. I have tried various a and b values and I also tried inputing a u value but that only gave me a striaght line. I also tried your suggestion of increasing the b value by 10x but still an increasing straight line. I'm new to MATLAB and Simulink so if you have any other methods on how I can acheive my goal, I wuld love to hear it. Down below is the final output graph.
VBBV
VBBV 2024 年 9 月 11 日
@Rohan, Use a closely space intervals for range of values, along with coefficient adjustment as mentioned by @Les Beckham
u = 0:0.001:5;% use a closely spaced intervals for the range of values
y = exp_temp(u);
plot(u, y)
grid on
function y = exp_temp(u)
% Exponential function for temperature degradation
a = 0.1; % adjust this value to fit the data
b = 1; % adjust this value to fit the data <<< I increased this by 10x
y = a * exp(b * u);
end
Sam Chak
Sam Chak 2024 年 9 月 11 日
Hi Rohan,
The solution for the differential equation of
dx/dt = k·x, with initial value x(0)
is given by
x(t) = x(0)·exp(k·t),
where k·x is a straight line.
From the response of the Integrator in the Scope in the image "Screenshot 2024-09-10 143401.png", you were simulating a dynamic system in Simulink. Best to share the Simulink slx file for evaluation.

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

Image Analyst
Image Analyst 2024 年 9 月 10 日

0 投票

I don't know how to do it in Simulink, but this seems to work fine in MATLAB:
uTemperatureRange = linspace(10, 200, 1000);
yDegradation = exp_temp(uTemperatureRange);
plot(uTemperatureRange, yDegradation, 'b-', 'LineWidth', 2);
xlabel('Temperature');
ylabel('Degradation');
title('Degradation vs. Temperature');
grid on;
ylim([0,6])
%==========================================================
function y = exp_temp(u)
% Exponential function for temperature degradation
a = 0.1; % adjust this value to fit the data
b = 0.02; % adjust this value to fit the data
y = a * exp(b * u);
end
It looks (and is) exponential.

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

製品

リリース

R2024a

質問済み:

2024 年 9 月 10 日

コメント済み:

2024 年 9 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by