.


:




:

































 

 

 

 


10.




.
. -

1. . : , , . fopen . , ( t , , ):

rt ;

rt+ ;

wt ;

wt+ .

, .

fprintf.

fprintf . fprintf . \r\n

1. -

 

[F,mes]=fopen('t.txt','w');

fprintf(F,' fprintf.');

fprintf(F,' ');

fprintf(F,'\r\n \r\n');

fprintf(F,' ')

fclose(F);

 

t.txt :

 

fprintf.

2. .

[F,mes]=fopen('t1.txt','w');

%

fprintf(F,' sin x \r\n');

%

fprintf(F,' _________________ \r\n')

 

fprintf(F,'| x | sin x |\r\n')

fprintf(F,' _________________ \r\n')

fclose(F);

 

.

fprintf :

Fprintf(, , )

. 3.

[F,mes]=fopen('t3.txt','w');

x=pi/2;

y=sin(x);

fprintf(F,' x=%7.4f sin(x)=%11.8f',x,y);

fclose(F);

x= 1.5708 sin(x)= 1.00000000

%7.4f , . , 7 , 7 , 4 - 4 , f , .

.

. 4.

[F,mes]=fopen('t3.txt','w');

x=[0:pi/4:2*pi];

y=sin(x);

M=[x;y]

fprintf(F,' |%7.4f |%11.8f|\r\n',M);

fclose(F);

| 0.0000 | 0.00000000|

| 0.7854 | 0.70710678|

| 1.5708 | 1.00000000|

| 2.3562 | 0.70710678|

| 3.1416 | 0.00000000|

| 3.9270 |-0.70710678|

| 4.7124 |-1.00000000|

| 5.4978 |-0.70710678|

| 6.2832 |-0.00000000|

 

1. 1, : , . .

 

2. . , . , , . . celldisp(M) . cellplot(m). , - .

5.

m{1,1}=' ';

m{1,2}=[5 4 3 5];

m{2,1}=' ';

m{2,2}=[5 2 3 5;4 3 2 4];

>> m

m =

' ' [1x4 double]

' ' [2x4 double]

>> celldisp(m)

m{1,1} =

m{2,1} =

m{1,2} =

5 4 3 5

 

m{2,2} =

5 2 3 5

4 3 2 4

>> cellplot(m)

 

2. : , , - 2.





:


: 2016-10-06; !; : 465 |


:

:

, - , ; , - .
==> ...

1490 - | 1503 -


© 2015-2024 lektsii.org - -

: 0.009 .