이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
how to find unknowns for series of input values?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all:
how to find x and y for series of values of m and n.
2xm-3yn=100
x+y=50
where n and m are constants such that
m=[2 5 7 10]
n=[4 20 3 4]
i want to find x and y for all m and n values such taht x and y for the first values of m and n(m=2 & n=4).
again x and y for second values of m and n(m=5 & n=20) and so on...
thanks from all of you.
채택된 답변
Alan Stevens
2020년 10월 15일
Do you mean you want to find the values of x and y that satisfy 2*x*2 - 3*y*4 = 100? If so you should be aware that there are an infinite number of solutions!
Or do you mean you want to find the values of x and y that are a best fit to all 4 sets of equations simultaneousy?
댓글 수: 32
Engineer Batoor khan mummand
2020년 10월 15일
thank from your reply:
i want to find values of x and y under n and m condition .
i mean i want to find x and y for first values of m and n second i wnt to find values of x and y by using second values of m and n... up to the last values of m and n .
thanks
Engineer Batoor khan mummand
2020년 10월 15일
find :
x and y whre m=2 and n=4
x and y whre m=5and n=20
x and y whre m=7 and n=3
x and y whre m=10 and n=4
thanks
Alan Stevens
2020년 10월 15일
As I said, there are an infinite number of solutions. Take the first one for example:
4x - 12y = 100
y = 1, x = 28
y = 2, x = 31
y = 3, x = 34
...etc.
Engineer Batoor khan mummand
2020년 10월 15일
편집: Engineer Batoor khan mummand
2020년 10월 15일
thanks dear:
i edited the question , i hope you got my point.
thanks
Alan Stevens
2020년 10월 15일
Ok.
m=[2 5 7 10];
n=[4 20 3 4];
for i = 1:4
M = [2*m(i) -3*n(i); 1 1];
V = [100; 50];
xy = M\V;
x(i) = xy(1);
y(i) = xy(2);
end
disp(x)
disp(y)
Engineer Batoor khan mummand
2020년 10월 16일
done....
thank you so much from your help and support.
thanks
Engineer Batoor khan mummand
2020년 10월 16일
hi Alan Stevens:
M = [2*m(i) -3*n(i); 1 1]; if you give me some information about [;1 1] you have given in code.
thanks
Alan Stevens
2020년 10월 16일
I hope the following explains it (you'll need to know about matrix multiplication to understand it):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/382733/image.jpeg)
Engineer Batoor khan mummand
2020년 10월 16일
okkkkkkk.......
thank you so much from your help and support.
Engineer Batoor khan mummand
2020년 10월 16일
hi Alan Stevens :
i want to solve this problem by your method but it give me some problems
it is same to same problem like you have solved in last comments...
syms Tg T1 T2 Tb Tc Tw2
I=[116 207 414 611 909 1009 951 909 805 615 311 120];
Ta=[29 30 31 32 33 34 35 37 36 35 34 33];
m=100;
n=40;
k=4180;
E1=I+k*I+k(Tc-T2)==4*k*(T2-Tb);
E2=m.*I+4.*I+(T2-Tb)==m*(Tb-Tw1);
E3=2*m.*I+(T1-Tc)==(Tc-Ta)))*I+(Tc-T2);
E4=3*n*I+(Tg-T1)==(T1-Tc);
E5=3*I==(Tg-Ta)+(Tg-T1);
E6=(Tb-Tw1)==(40*k*m*(Tw2-Tw1));
sol = solve([E1, E2, E3,E4,E5,E6],[T2,Tb,T1,Tc,Tg,Tw2]);
T2 = sol.T2
Tb = sol.Tb
Tg = sol.Tg
T1 = sol.T1
Tc = sol.Tc
Note: to find all 6 unknowns from 6 equations by using values of I and Ta....
i will be very thankful to help me in this problem.
thanks
Alan Stevens
2020년 10월 16일
편집: Alan Stevens
2020년 10월 16일
(1) You have Tw1 in your equations, but haven't specified it.
(2) To use the matrix method you first need to rewrite the equations so that the unknowns are collected on the left-hand side and the known values are on the right hand side. For example, E1 would need to be rewritten as
5*k*T2 - 4*k*Tb - k*Tc + 0*Tg + 0*T1 + 0*Tw2 = I*(1+k)
The coefficients of the first row of matrix M would then be [5*k, -4*k, -k, 0, 0, 0] and the first entry in vector V would be I*(1+k)
The other equations need to be arranged similarly, ensuring the unknowns (T2, Tb etc) are arranged in the same order in every row.
Alan Stevens
2020년 10월 16일
편집: Alan Stevens
2020년 10월 16일
Like the following. However, you need to check your equations carefully as well as checking that I've rearranged them correctly:
I=[116 207 414 611 909 1009 951 909 805 615 311 120];
Ta=[29 30 31 32 33 34 35 37 36 35 34 33];
Tw1 = 20;
m=100;
n=40;
k=4180;
%E1=I+k*I+k(Tc-T2)==4*k*(T2-Tb);
%E2=m.*I+4.*I+(T2-Tb)==m*(Tb-Tw1);
%E3=2*m.*I+(T1-Tc)==(Tc-Ta)))*I+(Tc-T2);
%E4=3*n*I+(Tg-T1)==(T1-Tc);
%E5=3*I==(Tg-Ta)+(Tg-T1);
%E6=(Tb-Tw1)==(40*k*m*(Tw2-Tw1));
% Rewrite as follows:
% 5*k*T2 -4*k*Tb -k*Tc + 0*T1 + 0*Tg + 0*Tw2 = I*(1+k)
% T2 -(1+m)*Tb + 0*Tc + 0*T1 + 0*Tg + 0*Tw2 = -m*Tw1 - (4+m)*I
% T2 + 0*Tb -(2+I)*Tc + T1 + 0*Tg + 0*Tw2 = -(Ta+2*m)*I
% 0*T2 + 0*Tb - Tc + 2*T1 - Tg + 0*Tw2 = 3*n*I
% 0*T2 + 0*Tb +0*Tc - T1 + 2*Tg + 0*Tw2 = 3*I
% 0*T2 + Tb + 0*Tc + 0*T1 + 0*Tg - 40*k*m*Tw2 = (1+40*k*m)*Tw1
T = zeros(6,numel(I));
for i = 1:numel(I)
M = [5*k, -4*k, -k, 0, 0, 0;
1, -(1+m), 0, 0, 0, 0;
1, 0, -(2+I(i)), 1, 0, 0;
0, 0, -1, 2, -1, 0;
0, 0, 0, -1, 2, 0;
0, 1, 0, 0, 0, -40*k*m];
V = [(1+k)*I(i);
-m*Tw1-(4+m)*I(i);
-(Ta(i)+2*m)*I(i);
3*n*I(i);
3*I(i);
(1+40*k*m)*Tw1];
T(:,i) = M\V;
end
T2 = T(1,:);
Tb = T(2,:);
Tc = T(3,:);
T1 = T(4,:);
Tg = T(5,:);
Tw2 = T(6,:);
disp(T)
Engineer Batoor khan mummand
2020년 10월 16일
it is done ,thank you so much from your helping....
thanks once again dear Alan Stevens .
Alan Stevens
2020년 10월 16일
Note; I have edited the previous coding. The expression for T2 is now
T2 = T(1,:);
not
T2 = T(:,1);
Similarly for Tb, Tc etc.
Engineer Batoor khan mummand
2020년 10월 19일
hi Alan Stevens:
i hop you will be fine and doing well...
i need so help dear in above problem if i say i want to find Tw(i+1) where i=1 Wso when we have Tw1=20;
for each I and Ta i want to find Tw(i+1)...
thanks
Engineer Batoor khan mummand
2020년 10월 19일
problem is same just i want Tw(i+1) such that :
i=1 Twi=Tw1=20;
for first I Ta we will find Tw(i+1)=Tw2?
for second ittration we havw i=2 so Tw(i)=Tw2
Tw(i+1)=Tw(2+1)=Tw3
and so on
Alan Stevens
2020년 10월 19일
I don't really understand what you are asking. You need to set out the equations you are trying to solve in mathematical form, not computer language, for me to stand a chance of understanding.
Engineer Batoor khan mummand
2020년 10월 19일
편집: Engineer Batoor khan mummand
2020년 10월 19일
thanks from your reply dear . ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/385113/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/385113/image.png)
Alan Stevens
2020년 10월 19일
Hmm. A couple of the equations are different from the ones you posted originally. In particular E6 contains Ti on the LHS. This means you have 7 unknowns, namely Tc T2 Tb Tw T1 Tg and Ti, but only 6 equations! You need another (independent) equation.
What is the physical system these equations represent?
Engineer Batoor khan mummand
2020년 10월 19일
Thanks from u r reply dear ... Twi will be come Tw1 for first iteration when i=1,from this we will find Tw(i+1)=Tw2 For next iteration when i=2 than Twi will become Tw2 which we have already found in iteration one we will find Tw3... Thanks
Alan Stevens
2020년 10월 19일
I wasn't referring to Tw(i+1) as the extra T, but Ti, which appears on the left-hand side of equation E6.
Engineer Batoor khan mummand
2020년 10월 19일
편집: Engineer Batoor khan mummand
2020년 10월 19일
Sorry dear in equation 6 we have (Tb-Twi) and another mistakes which in equation 1 and that is 4k(T2-Tb). Thanks
Alan Stevens
2020년 10월 19일
Well, the following does the calculation, but the Tw values stay constant!
I=[116 207 414 611 909 1009 951 909 805 615 311 120];
Ta=[29 30 31 32 33 34 35 37 36 35 34 33];
Tw1 = 20;
m=100;
n=40;
k=4180;
T = zeros(6,numel(I));
Tw = Tw1;
for i = 1:numel(I)
M = [5*k, -4*k, -k, 0, 0, 0;
1, -(1+m), 0, 0, 0, 0;
1, 0, -(2+I(i)), 1, 0, 0;
0, 0, -1, 2, -1, 0;
0, 0, 0, -1, 2, 0;
0, 1, 0, 0, 0, -40*k*m];
V = [(1+k)*I(i);
-m*Tw-(4+m)*I(i);
-(Ta(i)+2*m)*I(i);
3*n*I(i);
3*I(i);
(1-40*k*m)*Tw];
T(:,i) = M\V;
Tw = T(6,i);
end
T2 = T(1,:);
Tb = T(2,:);
Tc = T(3,:);
T1 = T(4,:);
Tg = T(5,:);
Tw = T(6,:);
disp(T)
Engineer Batoor khan mummand
2020년 10월 21일
thanks you so much dear from your supprt and help my problem is solved .
once agian thank you
Engineer Batoor khan mummand
2020년 10월 22일
hi dear:
i want to import average of each day from attached excl file but average of those solar radiation which is greather from 200 i mean ignoring all solar radiation of each day whic is less than 200.
i will be very thankful dear .
thanks
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)