the last commit for lab6 exercises and a2 exercises

This commit is contained in:
2025-12-09 19:26:41 +08:00
parent cfab7130bd
commit 477d4d1668
29 changed files with 188 additions and 4 deletions

4
lab6/exercise6_1.m Normal file
View File

@@ -0,0 +1,4 @@
A=[0,9,6;1,3,0];
B=[1,4,3;1,5,0];
A&B
A./B

3
lab6/exercise6_10.m Normal file
View File

@@ -0,0 +1,3 @@
syms x;
eq1=x^4-4*x^3+12*x-9==0;
x=solve(eq1,x)

8
lab6/exercise6_8.m Normal file
View File

@@ -0,0 +1,8 @@
for k=1:10
if k>6
break
else
arry(k)=k;
end
end
disp(arry);

7
lab6/exercise6_9.m Normal file
View File

@@ -0,0 +1,7 @@
i=2;
a=2i;
b=2*i;
c=2*sqrt(-1);
a
b
c

4
lab6/exercise6_c_1.m Normal file
View File

@@ -0,0 +1,4 @@
A=[1,2,3;4:6;7:9];
C=[A;[10,11,12]];
D=C(1:3,[2,3]);
E=C(2,[1,2]);

9
lab6/exercise6_c_2.m Normal file
View File

@@ -0,0 +1,9 @@
x=[0,1,0,2,0,3,0,4];
for k=1:8
if x(k)==0
x(k)=k;
else
x(k)=2*k+1;
end
end
disp(x)

3
lab6/exercise6_c_3.m Normal file
View File

@@ -0,0 +1,3 @@
syms a b c x;
s=a*x^2+b*x+c;
solve(s)

3
lab6/exercise6_c_4.m Normal file
View File

@@ -0,0 +1,3 @@
A=[2,3,1,2;1,3,0,1;1,-1,1,8;7,1,-2,2];
B=[8,6,1,5];
A\B'

7
lab6/exercise6_c_5.m Normal file
View File

@@ -0,0 +1,7 @@
t=linspace(0,2*pi,50);
y1=sin(2.*t-0.3);
y2=3.*cos(t+0.5);
plot(t,y1,'-.ro');
hold on
plot(t,y2,':b*');
hold off

8
lab6/exercise6_d.m Normal file
View File

@@ -0,0 +1,8 @@
for i=100:999
a=fix(i/100); %
b=rem(fix(i/10),10); %
c=rem(i,10); %
if a^3+b^3+c^3==i
disp(i);
end
end

11
lab6/lab6.m Normal file
View File

@@ -0,0 +1,11 @@
[F,P]=uigetfile('*.pgm;*.jpg;*.jpeg;*.tif;*.tiff;*.bmp;*.png;*.hdf;*.pcx;*.xwd','');
imna=strcat(P,F);
myi=imread(imna);
figure(1);
imshow(myi);
figure(2);
image(myi);
bgray=rgb2gray(myi);
figure(3);
imshow(bgray);
imwrite(bgray,'th.bmp','bmp');

BIN
lab6/th.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB