Upload
agustinhidayah
View
56
Download
7
Embed Size (px)
DESCRIPTION
matlab
Citation preview
TRAPESOIDAL
>> x=linspace(0,2,50);
>> %definisikan vektor x
>> y=exp(-x.^3);
>> % hitung nilai y
>> integral=trapz(x,y)
integral =
0.8930
Contoh soal
>> clear all
>> F = 10
F =
10
>> D = 10
D =
10
>> M = 20
M =
20
>> xf = 0.32
xf =
0.3200
>> Xf = 0.32
Xf =
0.3200
>> Xwo = 0.32
Xwo =
0.3200
>> alpha =2.48
alpha =
2.4800
>> YDn = 0.4
YDn =
0.4000
>> % melakukan perhitungan Xwn
>> YDn = alpha*Xwn/(1-((alpha-1)*Xwn)
??? YDn = alpha*Xwn/(1-((alpha-1)*Xwn)
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
>> Xw =YDn/(alpha-(alpha-1)*YDn
??? Xw =YDn/(alpha-(alpha-1)*YDn
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
>> Xw = YDn./(alpha-(alpha-1)*YDn
??? Xw = YDn./(alpha-(alpha-1)*YDn
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
>> Xw = YDn./(alpha-(alpha-1)*YDn)
Xw =
0.2119
>> Xwn =YDn./(alpha-(alpha-1)*YDn)
Xwn =
0.2119
>> Xw = linspace(Xwo,Xwn,100)
Xw =
Columns 1 through 8
0.3200 0.3189 0.3178 0.3167 0.3156 0.3145 0.3134 0.3124
Columns 9 through 16
0.3113 0.3102 0.3091 0.3080 0.3069 0.3058 0.3047 0.3036
Columns 17 through 24
0.3025 0.3014 0.3003 0.2992 0.2982 0.2971 0.2960 0.2949
Columns 25 through 32
0.2938 0.2927 0.2916 0.2905 0.2894 0.2883 0.2872 0.2861
Columns 33 through 40
0.2850 0.2840 0.2829 0.2818 0.2807 0.2796 0.2785 0.2774
Columns 41 through 48
0.2763 0.2752 0.2741 0.2730 0.2719 0.2708 0.2698 0.2687
Columns 49 through 56
0.2676 0.2665 0.2654 0.2643 0.2632 0.2621 0.2610 0.2599
Columns 57 through 64
0.2588 0.2577 0.2566 0.2556 0.2545 0.2534 0.2523 0.2512
Columns 65 through 72
0.2501 0.2490 0.2479 0.2468 0.2457 0.2446 0.2435 0.2424
Columns 73 through 80
0.2414 0.2403 0.2392 0.2381 0.2370 0.2359 0.2348 0.2337
Columns 81 through 88
0.2326 0.2315 0.2304 0.2293 0.2282 0.2272 0.2261 0.2250
Columns 89 through 96
0.2239 0.2228 0.2217 0.2206 0.2195 0.2184 0.2173 0.2162
Columns 97 through 100
0.2151 0.2140 0.2130 0.2119
>> Yd = alpha.*Xw/(1-((alpha-1).*Xw)
??? Yd = alpha.*Xw/(1-((alpha-1).*Xw)
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
>> Yd = alpha.*Xw/1-(alpha-1)*Xwn)
??? Yd = alpha.*Xw/1-(alpha-1)*Xwn)
|
Error: Unbalanced or unexpected parenthesis or bracket.
>> Yd=alpha.*Xw/1-(alpha-1).*Xw)
??? Yd=alpha.*Xw/1-(alpha-1).*Xw)
|
Error: Unbalanced or unexpected parenthesis or bracket.
>> Yd = alpha.*Xw/(1-(alpha-1).*Xw)
Yd =
1.0713
>> ti = M./(F.*Xf-D.*Yd)
ti =
-2.6621
>> t = trapz(Xw,ti)
??? Error using ==> permute
ORDER contains an invalid permutation index
Error in ==> trapz at 44
y = permute(y,perm);
>> Yd =alpha.*Xw./(1-(alpha-1).*Xw)
Yd =
Columns 1 through 8
1.5076 1.4979 1.4882 1.4785 1.4690 1.4595 1.4500 1.4406
Columns 9 through 16
1.4313 1.4220 1.4128 1.4036 1.3945 1.3854 1.3764 1.3674
Columns 17 through 24
1.3585 1.3497 1.3409 1.3321 1.3234 1.3147 1.3061 1.2976
Columns 25 through 32
1.2891 1.2806 1.2722 1.2639 1.2555 1.2473 1.2391 1.2309
Columns 33 through 40
1.2228 1.2147 1.2066 1.1987 1.1907 1.1828 1.1749 1.1671
Columns 41 through 48
1.1593 1.1516 1.1439 1.1363 1.1287 1.1211 1.1136 1.1061
Columns 49 through 56
1.0986 1.0912 1.0839 1.0765 1.0693 1.0620 1.0548 1.0476
Columns 57 through 64
1.0405 1.0334 1.0263 1.0193 1.0123 1.0054 0.9984 0.9916
Columns 65 through 72
0.9847 0.9779 0.9711 0.9644 0.9577 0.9510 0.9444 0.9378
Columns 73 through 80
0.9312 0.9247 0.9181 0.9117 0.9052 0.8988 0.8924 0.8861
Columns 81 through 88
0.8798 0.8735 0.8672 0.8610 0.8548 0.8487 0.8425 0.8364
Columns 89 through 96
0.8304 0.8243 0.8183 0.8123 0.8063 0.8004 0.7945 0.7886
Columns 97 through 100
0.7828 0.7770 0.7712 0.7654
>> ti = M./(F.*Xf-D.*Yd)
ti =
Columns 1 through 8
-1.6841 -1.6980 -1.7121 -1.7263 -1.7407 -1.7552 -1.7699 -1.7847
Columns 9 through 16
-1.7997 -1.8149 -1.8302 -1.8457 -1.8614 -1.8772 -1.8933 -1.9095
Columns 17 through 24
-1.9258 -1.9424 -1.9591 -1.9761 -1.9932 -2.0106 -2.0281 -2.0459
Columns 25 through 32
-2.0638 -2.0820 -2.1004 -2.1190 -2.1378 -2.1568 -2.1761 -2.1957
Columns 33 through 40
-2.2154 -2.2354 -2.2557 -2.2762 -2.2970 -2.3180 -2.3394 -2.3609
Columns 41 through 48
-2.3828 -2.4050 -2.4274 -2.4502 -2.4732 -2.4966 -2.5202 -2.5442
Columns 49 through 56
-2.5686 -2.5932 -2.6182 -2.6436 -2.6693 -2.6954 -2.7218 -2.7487
Columns 57 through 64
-2.7759 -2.8035 -2.8316 -2.8600 -2.8889 -2.9182 -2.9479 -2.9781
Columns 65 through 72
-3.0088 -3.0400 -3.0716 -3.1037 -3.1364 -3.1695 -3.2032 -3.2375
Columns 73 through 80
-3.2723 -3.3077 -3.3437 -3.3803 -3.4175 -3.4553 -3.4938 -3.5330
Columns 81 through 88
-3.5729 -3.6134 -3.6547 -3.6968 -3.7396 -3.7832 -3.8276 -3.8728
Columns 89 through 96
-3.9189 -3.9658 -4.0137 -4.0625 -4.1123 -4.1630 -4.2148 -4.2676
Columns 97 through 100
-4.3215 -4.3765 -4.4327 -4.4900
>> t = trapz(Xw,ti)
t =
0.2983
SISTEM LINEAR
>> clear all
>> A = (5 -3 1 0;1 2 -3 1;0 3 -5 0;-1 0 2 -1)
??? A = (5 -3 1 0;1 2 -3 1;0 3 -5 0;-1 0 2 -1)
|
Error: Unexpected MATLAB expression.
>> A = (5 -3 1 0 ; 1 2 -3 1 ; 0 3 -5 0 ; -1 0 2 -1)
??? A = (5 -3 1 0 ; 1 2 -3 1 ; 0 3 -5 0 ; -1 0 2 -1)
|
Error: Unexpected MATLAB expression.
>> A = [5 -3 1 0;1 2 -3 1;0 3 -5 0;-1 0 2 -1]
A =
5 -3 1 0
1 2 -3 1
0 3 -5 0
-1 0 2 -1
>> B = [X1;X2;X3;X4)
??? B = [X1;X2;X3;X4)
|
Error: Unbalanced or unexpected parenthesis or bracket.
>> B = [X1;X2;X3;X4]
??? Undefined function or variable 'X1'.
>> B = [5 1 -5 0]
B =
5 1 -5 0
>> b [5;1;-5;0]
??? b [5;1;-5;0]
|
Error: Unbalanced or unexpected parenthesis or bracket.
>> B = [5;1;-5;0]
B =
5
1
-5
0
>>