Filter löschen
Filter löschen

Can any one solve this quistion?

1 Ansicht (letzte 30 Tage)
Fatima Al Marzoqi
Fatima Al Marzoqi am 3 Jul. 2014
Kommentiert: Image Analyst am 4 Jul. 2014
Can someone help me to write this code? I already start but I stocked at a point !
  2 Kommentare
Cedric
Cedric am 3 Jul. 2014
What have you done so far?
Fatima Al Marzoqi
Fatima Al Marzoqi am 4 Jul. 2014
Bearbeitet: Cedric am 4 Jul. 2014
Let me show you the first part which is using Gause-Jordan
this is my code
%Reading the values of resistors, voltages, initial currents, tolerance and relaxation factor
R=input(' Enter the values of resistors in k ohm , [ R1 R2 R3 R4 R5 R6 R7 R8 R9 ] = ');
V=input(' Enter the values of voltages in volt , [ V1 V2 ] = ');
I=input(' Enter the values of initial currents in mA , [ I1 , I2 , I3 ,
I4 ] = ');
T=input(' Enter the value of tolerance in mA , T = ');
a=input(' Enter the value of relaxation factor , a = ');
%Describe the resistor matrix R
R= [ R(8)+R(5)+R(3) , -R(5) , 0 , -R(3) ;
-R(5) , R(7)+R(1)+R(4)+R(5) , -R(4) , 0 ;
0 , -R(4) , R(2)+R(6)+R(4) , -R(6) ;
-R(3) , 0 , -R(6) , R(6)+R(9)+R(3) ];
%Describe the voltage matrix V
V= [ V(1) ;
0 ;
0 ;
V(2) ];
%Describe the initial currents matrix I
I= [ I(1) ;
I(2) ;
I(3) ;
I(4) ];
%The tolerance value T
T= T;
%The relaxation factor value
a= a;
%mesh currents in mA using Gause-Jordan Elimination method
C=[R,V]; %augmanted matrix
for j=1:4
for z=2:4 %pivoting
if R(j,j)==0
t=R(1,:);R(1,:)=R(z,:);
R(z,:)=t;
end
end
for i=j+1:4 %Convert the elements below the major diagonal to zeros
R(i,:)= R(i,:)-R(j,:)*( R(i,j)/R(j,j) );
end
end
for j=4:-1:2 %Convert the elements above the major diagonal to zeros
for i=j-1:-1:1
R(i,:)= R(i,:)-R(j,:)*( R(i,j)/R(j,j) );
end
end
for s=1:4 %Convert the elements on the major diagonal to ones
R(s,:)= R(s,:)/R(s,s);
x(s)= R(s,4);
end
disp (' Gause-Jordan Elemination method: ');
R
x'
The problem is with the last column which is x, check it also, I want to ask.. how I type the value of tolerance and relaxation factor? in a matrix or it is true what I do?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 3 Jul. 2014
For (a), try inputdlg().
For (c), try fopen(), fprintf(), and fclose().
For (d), try plot().
After that if you still need help, read this http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers and come back here with your code.
  1 Kommentar
Image Analyst
Image Analyst am 4 Jul. 2014
Well, it used to make sense before you totally changed your question!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Convert Image Type 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