Solution of easy time dependent nonlinear problem
이전 댓글 표시
Hello everyone,
I'm interested in how I can overcome the following problem. I want to calculate the value of the function at given time intervals defined by dt, and the function is given by: Temp (n) = datad (n-1) * 170 / c (n-1). data d is a time dependent function and its value is easy to calculate in each individual step. The problem arises in finding the value of c (n) for a given Temp (n). c (n) is defined by the function in Matlab code.
Since I have not encountered this type of problem before, any help is welcome. I'm sure the part in the loop needs to be modified, but I'm not sure how.
Attached is the Matlab code that needs to be slightly modified.
clc;clear all;close all;
dt=5;
ntime=15;
time=-dt;
datad=[];
for n=1:ntime+1
time = time + dt;
Tb=300+345*log10(8*(time/60)+1); % [C]
datad=[datad;Tb];
end
datad
c=zeros(ntime+1,1);
c(1)=425;
Temp=zeros(ntime+1,1);
Temp(1)=20;
for n=2:ntime+1
Temp(n)=datad(n-1)*170/c(n-1);
% Temp takes the value of c and datad from previous time step
% Values of parameter c is based on Temp i.e. c=c(Temp)
if 20>=Temp(n) & Temp(n)<600
c(n)=425+7.73*10^(-1)*Temp(n)-1.69*10^(-3)*Temp(n)^2+2.22*10^(-6)*Temp(n)^3;
else if 600>=Temp(n) & Temp(n)<735
c(n)=666+13002/(738-Temp(n));
else if 735>=Temp(n) & Temp(n)<900
c(n)=545+17820/(Temp(n)-731);
else
c(n)=650;
end
end
end
end
Temp
c
댓글 수: 1
Are Mjaavatten
2020년 5월 28일
It is not clear to me what you want to do. You say tou want to find the value of c (n) for a given Temp (n). This is exactly what your script does. So obviously, you mean something else. Please try to reformulate your question.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!