Filter löschen
Filter löschen

get problem with while loop

2 Ansichten (letzte 30 Tage)
Israt Jahan
Israt Jahan am 14 Jul. 2016
Beantwortet: Israt Jahan am 26 Jul. 2016
Hi I have written this code to calculate T1...T5 value. Where every loop works with value of R1...R5. But it does not work. Anyone please tell me what type of mistake i made to write this code.
clear all
%%%Thermal resistance
R1=0.0016;
R2=0.0018;
R3=0.00036;
R4=0.00032;
R5=0.0005;
p=25000;
Tc=25;
Tj=125;
%%%%Temperature of each layer
x=6;y=6;
while x<6&&y<6
x=x+1;
y=y+1;
Ty=Tc+(Rx*p);
end

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 14 Jul. 2016
R = [0.0016;0.0018;0.00036;0.00032;0.0005];
p=25000;
Tc=25;
T = Tc+(R*p);

Weitere Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 14 Jul. 2016
Bearbeitet: Azzi Abdelmalek am 14 Jul. 2016
Rx is an undefined variable, you need to put R1,R2,...,R5 in a vector
%%%Thermal resistance
R1=0.0016;
R2=0.0018;
R3=0.00036;
R4=0.00032;
R5=0.0005;
R=[R1 R2 R3 R4 R5];
p=25000;
Tc=25;
Tj=125;
%%%%Temperature of each layer
x=0;y=0;
while x<5&&y<5
x=x+1;
y=y+1;
Ty(x)=Tc+(R(x)*p);
end
Ty

Israt Jahan
Israt Jahan am 26 Jul. 2016
thank you so much

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by