フィルターのクリア

How to plot a math function with a vector

1 回表示 (過去 30 日間)
David Sicic
David Sicic 2022 年 10 月 19 日
コメント済み: David Sicic 2022 年 10 月 19 日
Hello everbody,
I have a problem with a task. I've read an excel data into matlab and worked with this data. As i made an integral with the values of my excel data, i now have to take those values and make a math function as following : Zth = (Tmax - T_j) / P. I dont know how to implimate that vector of T_j into the function and generate a plot out of it.
Best regards
David
clear all;
close all;
clc;
values = xlsread('Beispiel-Kurven', 'Fit 0');
cooling_time = values(:,1)';
R_F = values(:,4);
R_F = R_F(~isnan(R_F))';
C_F = values(:,5);
C_F = C_F(~isnan(C_F))';
dZ_th = @(t) 0;
for v = 1:length(R_F)
dZ_th = @(t) dZ_th(t) + exp(-t / (R_F(v) * C_F(v))) / C_F(v);
end
P = @(t) 10;
T_j_scalar_t = @(t) integral(@(tau) P(tau) * dZ_th(t - tau), 0, t);
T_j = @(t) arrayfun(T_j_scalar_t, t);
Tmax = values(1,2)
Zth = (Tmax - T_j_scalar_t) / P
semilogx(cooling_time, Zth(cooling_time))
%semilogx(cooling_time, T_j(cooling_time))
  2 件のコメント
Torsten
Torsten 2022 年 10 月 19 日
Is it really correct that you want dZ_th to be defined as
dZ_th(t) = sum_{v=1}^{v=N} exp( -t*( R_F(v) * C_F(v) ) ) / C_F(v);
where N = length(R_F) ?
David Sicic
David Sicic 2022 年 10 月 19 日
yes

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

採用された回答

Torsten
Torsten 2022 年 10 月 19 日
編集済み: Torsten 2022 年 10 月 19 日
Then maybe
T_j_scalar_t = @(t) integral(@(tau) P(tau) .* dZ_th(t - tau), 0, t);
T_j = arrayfun(@(t)T_j_scalar_t(t), cooling_time);
Tmax = values(1,2);
Zth = (Tmax - T_j) ./ P(cooling_time);
semilogx(cooling_time, Zth)
  4 件のコメント
Torsten
Torsten 2022 年 10 月 19 日
編集済み: Torsten 2022 年 10 月 19 日
T_j and P(cooling_time) are vectors with the length of the array "cooling_time".
You want to divide them elementwise, thus ./ instead of /
Since P is a constant function, you could alternatively have used
Zth = (Tmax - T_j) / P(cooling_time(1));
David Sicic
David Sicic 2022 年 10 月 19 日
Great, thank you for your time and explanation!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by