Sheet 1
1.1 )
v(t)=10(1−e−0.2t
)
1.2 )
𝒁𝒁 =
( 𝟑𝟑 + 𝒋𝒋 𝒋𝒋)( 𝟔𝟔 + 𝒋𝒋 𝒋𝒋)
( 𝟐𝟐 + 𝒋𝒋 𝒋𝒋)(𝒋𝒋 𝒋𝒋)
+ 𝟕𝟕 + 𝒋𝒋 𝒋𝒋𝒋𝒋
>> t=0:5:50;
>> v=10*(1-exp(-.2*t));
>> table=[t',v']
table =
0 0
5.0000 6.3212
10.0000 8.6466
15.0000 9.5021
20.0000 9.8168
25.0000 9.9326
30.0000 9.9752
35.0000 9.9909
40.0000 9.9966
45.0000 9.9988
50.0000 9.9995
>>
>> z=((3+6*i)*(6+4*i))/((2+i)*2*i)+7+10*i
z =
17.2000 + 6.4000i
>>
Sheet 1
1.4 )
Write a function-file that can be used to
calculate the equivalent resistance of n
parallel connected resistors
1.3 )
Write a function-file to obtain the dot
product and the vector product of two
vectors a and b
function [c,d] = trial1(a,b)
d = sum(a.*b);
i = (a(2)*b(3))-(a(3)*b(2));
j = (a(3)*b(1))-(a(1)*b(3));
k = (a(1)*b(2))-(a(2)*b(1));
c = [i,j,k];
end
>> x=[1,5,6];
>> y=[2,3,8];
>> [c d]=trial1(x,y)
c =
22 4 -7
d =
65
>>
function R = trial2(x)
n = length(x);
y = 0;
for i = 1:n
y = y+(1/x(i));
end
R = (1/y);
Sheet 1
end
>> r=[100,200,300,400,500];
>> trial2(r)
ans =
43.7956
>>
>> R=[1 2 3;2 3 6;3 6 7];
>> I=[1;2;6];
>> v=R*I
v =
23
44
57
>>
>> y=0.5+j*6+3.5*exp(j*0.6)+(3+j*6)*exp(j*0.3*pi)
y =
0.2979 +13.9300i
>>
1.5 )
The voltage V is given as V=RI, where R
and I are resistance matrix and I current
vector. Evaluate V
1.6 )
simplify the expression
y=0.5+j6+3.5ej0.6
+(3+j6)ej0.3π
Sheet 1
function [ y ] = fact( n )
y=1;
i =1;
for i=1:n
y=i*y;
end
end
>> x=fact(7)/(fact(3)*fact(4))
x =
35
>>
function [ a ] = tarea( x , y , z )
s =(x+y+z)/2;
a= sqrt(s*(s-x)*(s-y)*(s-z));
end
>> tarea(56,27,43)
ans =
563.4891
>> tarea(5,12,13)
ans =
30
>>
1.7 )
Write a function file to evaluate n factorial (i.e. n!);
1.8 )
Write a function to compute the area
given the sides of a triangle.
NAME: Ahmed El-morsy Abdel-hamid
Sec: 1
about me :)
THANK YOU 

Sheet 1

  • 1.
    Sheet 1 1.1 ) v(t)=10(1−e−0.2t ) 1.2) 𝒁𝒁 = ( 𝟑𝟑 + 𝒋𝒋 𝒋𝒋)( 𝟔𝟔 + 𝒋𝒋 𝒋𝒋) ( 𝟐𝟐 + 𝒋𝒋 𝒋𝒋)(𝒋𝒋 𝒋𝒋) + 𝟕𝟕 + 𝒋𝒋 𝒋𝒋𝒋𝒋 >> t=0:5:50; >> v=10*(1-exp(-.2*t)); >> table=[t',v'] table = 0 0 5.0000 6.3212 10.0000 8.6466 15.0000 9.5021 20.0000 9.8168 25.0000 9.9326 30.0000 9.9752 35.0000 9.9909 40.0000 9.9966 45.0000 9.9988 50.0000 9.9995 >> >> z=((3+6*i)*(6+4*i))/((2+i)*2*i)+7+10*i z = 17.2000 + 6.4000i >>
  • 2.
    Sheet 1 1.4 ) Writea function-file that can be used to calculate the equivalent resistance of n parallel connected resistors 1.3 ) Write a function-file to obtain the dot product and the vector product of two vectors a and b function [c,d] = trial1(a,b) d = sum(a.*b); i = (a(2)*b(3))-(a(3)*b(2)); j = (a(3)*b(1))-(a(1)*b(3)); k = (a(1)*b(2))-(a(2)*b(1)); c = [i,j,k]; end >> x=[1,5,6]; >> y=[2,3,8]; >> [c d]=trial1(x,y) c = 22 4 -7 d = 65 >> function R = trial2(x) n = length(x); y = 0; for i = 1:n y = y+(1/x(i)); end R = (1/y);
  • 3.
    Sheet 1 end >> r=[100,200,300,400,500]; >>trial2(r) ans = 43.7956 >> >> R=[1 2 3;2 3 6;3 6 7]; >> I=[1;2;6]; >> v=R*I v = 23 44 57 >> >> y=0.5+j*6+3.5*exp(j*0.6)+(3+j*6)*exp(j*0.3*pi) y = 0.2979 +13.9300i >> 1.5 ) The voltage V is given as V=RI, where R and I are resistance matrix and I current vector. Evaluate V 1.6 ) simplify the expression y=0.5+j6+3.5ej0.6 +(3+j6)ej0.3π
  • 4.
    Sheet 1 function [y ] = fact( n ) y=1; i =1; for i=1:n y=i*y; end end >> x=fact(7)/(fact(3)*fact(4)) x = 35 >> function [ a ] = tarea( x , y , z ) s =(x+y+z)/2; a= sqrt(s*(s-x)*(s-y)*(s-z)); end >> tarea(56,27,43) ans = 563.4891 >> tarea(5,12,13) ans = 30 >> 1.7 ) Write a function file to evaluate n factorial (i.e. n!); 1.8 ) Write a function to compute the area given the sides of a triangle. NAME: Ahmed El-morsy Abdel-hamid Sec: 1 about me :) THANK YOU 