ptnbk50: bạn thử học cách sử dụng tool indetification trong mathlab xem
Thông báo
Collapse
No announcement yet.
Tổng hợp các câu hỏi về Matlab - Trả lời ngay
Collapse
This is a sticky topic.
X
X
-
minh la dan bat dau hoc matlap.cho minh hoi cac ban di truoc : bgio minh muon tao 1 tin hieu sin 50hz roi phan tich pho furier cua no thi bgio phai lam cac buoc nhu the nao?thay giao minh co yeu cau la fai tao ra tin hieu sin roi rac truoc roi phan tich pho cua no xem co dung = 50hz khong?neu khong thi tai sao?cam on cac ban rất nhieu!
Comment
-
các Bác giúp e với.e copy toàn bộ đoạn code gpt sau vào của sổ editor của matlab 7.0..nó ko chạy:
funtion [p1,err,k] = newtonraphson(f,df,po,delta,max1)
f=inline('sin(tan(x))-tan(sin(x))','x');
df=inline('cos(tan(x))/(cos(x).^2)-cos(x)/(cos(sin(x)).^2)','x');
po=input('po=');
delta=input('delta=');
max1=input('max1=');
for k=1:max1
p1=po-f(po)/df(po);
err=abs(p1-po);
po=p1;
if (err<delta),break,end
end
của sổ matlat hiện ra thông báo"Undefined command/function 'funtion'.
e ko hiểu tại sao lại như vậy nữa
hj,chắc là e nhầm topic nên ko có ai trả lời giùm
Comment
-
tui co cai game co ganh viet bang matlab ma ko bit lam the nao nua ai cuu tui voi ko
ong thay cho cai file minh hoa ma tui ko hieu j ca,
phen nay tieu rui,
function minhhoa(action,in1,in2);
int i,j;
global DATA;
if nargin < 1,
action='start';
end;
if strcmp(action,'start'),
clf reset;
figure(gcf);
set(gcf,'Units','normalized','NumberTitle','off', ...
'Name','Minh hoa GUI','backingstore','on');
min_x=1;
max_x=5;
x=1;
text1=uicontrol('Style','text','Units','normalized ',...
'Position',[.03 .03 .1 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','x',......
'HorizontalAlignment','center');
text2=uicontrol('Style','text','Units','normalized ',...
'Position',[.15 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(min_x)) ;
x1=uicontrol('Style','slider','Units','normalized' ,...
'Position',[.2 .03 .25 .05],...
'SliderStep',[5.0000e-004 5.0000e-003],...
'Value',x,'Max',max_x,'Min',min_x,...
'Callback','minhhoa(''setx'',1);minhhoa(''redraw'' );');
text3=uicontrol('Style','text', 'Units','normalized',...
'Position',[.45 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(max_x)) ;
x2=uicontrol('Style','edit', 'Units','normalized',...
'Position',[.55 .03 .09 .05],...
'FontSize',10','Fontname','VNI-Times',...
'String',num2str(x),...
'Callback','minhhoa(''setx'',2);minhhoa(''redraw'' )');
text4=uicontrol('Style','text','Units','normalized ',...
'Position',[.64 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','cm',...
'HorizontalAlignment','center');
min_y=1;
max_y=5;
y=2;
text1=uicontrol('Style','text','Units','normalized ','Position',[.03 .1 .1 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','Vò trí y:',...
'HorizontalAlignment','center');
text2=uicontrol('Style','text', 'Units','normalized','Position',[.15 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(min_y)) ;
y1=uicontrol('Style','slider','Units','normalized' ,'Position',[.2 .1 .25 .05],...
'SliderStep',[5.0000e-004 5.0000e-003],...
'Value',y,'Max',max_y,'Min',min_y,...
'Callback','minhhoa(''sety'',1);minhhoa(''redraw'' );');
text3=uicontrol('Style','text','Units','normalized ',...
'Position',[.45 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(max_y)) ;
y2=uicontrol('Style','edit','Units','normalized',. ..
'Position',[.55 .1 .09 .05],...
'FontSize',10','Fontname','VNI-Times',...
'String',num2str(y),...
'Callback','minhhoa(''sety'',2);minhhoa(''redraw'' )');
text4=uicontrol('Style','text','Units','normalized ',...
'Position',[.64 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','cm',...
'HorizontalAlignment','center');
nut1=uicontrol('Style','Pushbutton','Units','norma lized',...
'Position',[.87 .03 .1 .05],...
'FontSize',12,'Fontname','VNI-Times',...
'Callback','minhhoa(''done'')','String','Thoaùt');
dt=plot(x,y,'Marker','.','EraseMode','xor','color' ,'r','MarkerSize',60);
set(gca,'Position',[0.04 0.2 0.93 0.75]);
axis([0.8 5.2 0.8 5.2]);
grid;
set(dt,'ButtonDownFcn','minhhoa(''down'',1)');
DATA=[x;min_x;max_x;x1;x2;dt;y;min_y;max_y;y1;y2;0;0];
elseif strcmp(action,'down'),
dt = DATA(6);
ax=gca;
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
line_x=get(dt,'XData');
line_y=get(dt,'YData');
dist=(line_x-x).^2 + (line_y-y).^2;
[temp,i]=min(dist);
fixed_x=line_x(i);
fixed_y=line_y(i);
DATA(12)=fixed_x;
DATA(13)=fixed_y;
set(gcf,'WindowButtonMotionFcn', sprintf('minhhoa(''move'',%g)',in1));
set(gcf,'WindowButtonUpFcn', sprintf('minhhoa(''up'',%g)',in1));
elseif strcmp(action,'move'),
x=DATA(1);
min_x=DATA(2);
max_x=DATA(3);
y=DATA(7);
dt=DATA(6);
min_y=DATA(8);
max_y=DATA(9);
x1=DATA(10);
y1=DATA(11);
fixed_x=DATA(12);
fixed_y=DATA(13);
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
if (x>max_x ),
x=max_x ;
end;
if (x<min_x ),
x=min_x ;
end;
if (y>max_y ),
y=max_y ;
end;
if (y<min_y ),
y=min_y ;
end;
set(DATA(5),'string',num2str(x));
set(DATA(4),'value',x);
set(dt,'XData',x);
set(DATA(11),'string',num2str(y));
set(DATA(10),'value',y);
set(dt,'YData',y);
elseif strcmp(action,'up'),
x=DATA(1);
y=DATA(7);
dt=DATA(6);
x1=DATA(10);
y1=DATA(11);
min_x=DATA(2);
max_x=DATA(3);
min_y=DATA(8);
max_y=DATA(9);
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
if (x>max_x ),
x=max_x ;
end;
if (x<min_x ),
x=min_x ;
end;
if (y>max_y ),
y=max_y ;
end;
if (y<min_y ),
y=min_y ;
end;
set(gcf,'WindowButtonMotionFcn','');
set(gcf,'WindowButtonUpFcn','');
DATA(1)=x;
DATA(7)=y;
minhhoa('redraw');
elseif strcmp(action,'redraw'),
x=DATA(1);
y=DATA(7);
dt=DATA(6);
set(DATA(5),'string',num2str(x));
set(DATA(4),'value',x);
set(dt,'XData',x);
set(DATA(11),'string',num2str(y));
set(DATA(10),'value',y);
set(dt,'YData',y);
drawnow;
elseif strcmp(action,'setx'),
if (in1==1),
DATA(1)=get(DATA(4),'value');
else if (in1==2)
min_x=DATA(2);
max_x=DATA(3);
x=str2num(get(DATA(5),'string'));
if (x>max_x),
x=max_x;
end;
if (x<min_x),
x=min_x;
end;
DATA(1)=x;
end
end
elseif strcmp(action,'sety'),
if (in1==1),
DATA(7)=get(DATA(10),'value');
else if (in1==2)
min_y=DATA(8);
max_y=DATA(9);
y=str2num(get(DATA(11),'string'));
if (y>max_y),
y=max_y;
end;
if (y<min_y),
y=min_y;
end;
DATA(7)=y;
end
end
elseif strcmp(action,'done'),
clf reset;
clear global DATA
close;
end
thien thu van co rot la kho
van co thien thu kho van rot;
Comment
-


tui co cai game co ganh viet bang matlab ma ko bit lam the nao nua ai cuu tui voi ko
ong thay cho cai file minh hoa ma tui ko hieu j ca,
phen nay tieu rui,
function minhhoa(action,in1,in2);
int i,j;
global DATA;
if nargin < 1,
action='start';
end;
if strcmp(action,'start'),
clf reset;
figure(gcf);
set(gcf,'Units','normalized','NumberTitle','off', ...
'Name','Minh hoa GUI','backingstore','on');
min_x=1;
max_x=5;
x=1;
text1=uicontrol('Style','text','Units','normalized ',...
'Position',[.03 .03 .1 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','x',......
'HorizontalAlignment','center');
text2=uicontrol('Style','text','Units','normalized ',...
'Position',[.15 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(min_x)) ;
x1=uicontrol('Style','slider','Units','normalized' ,...
'Position',[.2 .03 .25 .05],...
'SliderStep',[5.0000e-004 5.0000e-003],...
'Value',x,'Max',max_x,'Min',min_x,...
'Callback','minhhoa(''setx'',1);minhhoa(''redraw'' );');
text3=uicontrol('Style','text', 'Units','normalized',...
'Position',[.45 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(max_x)) ;
x2=uicontrol('Style','edit', 'Units','normalized',...
'Position',[.55 .03 .09 .05],...
'FontSize',10','Fontname','VNI-Times',...
'String',num2str(x),...
'Callback','minhhoa(''setx'',2);minhhoa(''redraw'' )');
text4=uicontrol('Style','text','Units','normalized ',...
'Position',[.64 .03 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','cm',...
'HorizontalAlignment','center');
min_y=1;
max_y=5;
y=2;
text1=uicontrol('Style','text','Units','normalized ','Position',[.03 .1 .1 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','Vò trí y:',...
'HorizontalAlignment','center');
text2=uicontrol('Style','text', 'Units','normalized','Position',[.15 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(min_y)) ;
y1=uicontrol('Style','slider','Units','normalized' ,'Position',[.2 .1 .25 .05],...
'SliderStep',[5.0000e-004 5.0000e-003],...
'Value',y,'Max',max_y,'Min',min_y,...
'Callback','minhhoa(''sety'',1);minhhoa(''redraw'' );');
text3=uicontrol('Style','text','Units','normalized ',...
'Position',[.45 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'HorizontalAlignment','center',...
'ForegroundColor','white','String',num2str(max_y)) ;
y2=uicontrol('Style','edit','Units','normalized',. ..
'Position',[.55 .1 .09 .05],...
'FontSize',10','Fontname','VNI-Times',...
'String',num2str(y),...
'Callback','minhhoa(''sety'',2);minhhoa(''redraw'' )');
text4=uicontrol('Style','text','Units','normalized ',...
'Position',[.64 .1 .05 .05],...
'BackgroundColor',[0 0 .5],...
'FontSize',12,'Fontname','VNI-Times',...
'ForegroundColor','white','String','cm',...
'HorizontalAlignment','center');
nut1=uicontrol('Style','Pushbutton','Units','norma lized',...
'Position',[.87 .03 .1 .05],...
'FontSize',12,'Fontname','VNI-Times',...
'Callback','minhhoa(''done'')','String','Thoaùt');
dt=plot(x,y,'Marker','.','EraseMode','xor','color' ,'r','MarkerSize',60);
set(gca,'Position',[0.04 0.2 0.93 0.75]);
axis([0.8 5.2 0.8 5.2]);
grid;
set(dt,'ButtonDownFcn','minhhoa(''down'',1)');
DATA=[x;min_x;max_x;x1;x2;dt;y;min_y;max_y;y1;y2;0;0];
elseif strcmp(action,'down'),
dt = DATA(6);
ax=gca;
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
line_x=get(dt,'XData');
line_y=get(dt,'YData');
dist=(line_x-x).^2 + (line_y-y).^2;
[temp,i]=min(dist);
fixed_x=line_x(i);
fixed_y=line_y(i);
DATA(12)=fixed_x;
DATA(13)=fixed_y;
set(gcf,'WindowButtonMotionFcn', sprintf('minhhoa(''move'',%g)',in1));
set(gcf,'WindowButtonUpFcn', sprintf('minhhoa(''up'',%g)',in1));
elseif strcmp(action,'move'),
x=DATA(1);
min_x=DATA(2);
max_x=DATA(3);
y=DATA(7);
dt=DATA(6);
min_y=DATA(8);
max_y=DATA(9);
x1=DATA(10);
y1=DATA(11);
fixed_x=DATA(12);
fixed_y=DATA(13);
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
if (x>max_x ),
x=max_x ;
end;
if (x<min_x ),
x=min_x ;
end;
if (y>max_y ),
y=max_y ;
end;
if (y<min_y ),
y=min_y ;
end;
set(DATA(5),'string',num2str(x));
set(DATA(4),'value',x);
set(dt,'XData',x);
set(DATA(11),'string',num2str(y));
set(DATA(10),'value',y);
set(dt,'YData',y);
elseif strcmp(action,'up'),
x=DATA(1);
y=DATA(7);
dt=DATA(6);
x1=DATA(10);
y1=DATA(11);
min_x=DATA(2);
max_x=DATA(3);
min_y=DATA(8);
max_y=DATA(9);
pt=get(gca,'currentpoint');
x=pt(1,1);
y=pt(1,2);
if (x>max_x ),
x=max_x ;
end;
if (x<min_x ),
x=min_x ;
end;
if (y>max_y ),
y=max_y ;
end;
if (y<min_y ),
y=min_y ;
end;
set(gcf,'WindowButtonMotionFcn','');
set(gcf,'WindowButtonUpFcn','');
DATA(1)=x;
DATA(7)=y;
minhhoa('redraw');
elseif strcmp(action,'redraw'),
x=DATA(1);
y=DATA(7);
dt=DATA(6);
set(DATA(5),'string',num2str(x));
set(DATA(4),'value',x);
set(dt,'XData',x);
set(DATA(11),'string',num2str(y));
set(DATA(10),'value',y);
set(dt,'YData',y);
drawnow;
elseif strcmp(action,'setx'),
if (in1==1),
DATA(1)=get(DATA(4),'value');
else if (in1==2)
min_x=DATA(2);
max_x=DATA(3);
x=str2num(get(DATA(5),'string'));
if (x>max_x),
x=max_x;
end;
if (x<min_x),
x=min_x;
end;
DATA(1)=x;
end
end
elseif strcmp(action,'sety'),
if (in1==1),
DATA(7)=get(DATA(10),'value');
else if (in1==2)
min_y=DATA(8);
max_y=DATA(9);
y=str2num(get(DATA(11),'string'));
if (y>max_y),
y=max_y;
end;
if (y<min_y),
y=min_y;
end;
DATA(7)=y;
end
end
elseif strcmp(action,'done'),
clf reset;
clear global DATA
close;
end
thien thu van co rot la kho
van co thien thu kho van rot;
Comment
-
Hình như bạn gõ sai lệnh rồi : FUNCTION chứ ko phải funtion. okNguyên văn bởi co_chichi Xem bài viếtcác Bác giúp e với.e copy toàn bộ đoạn code gpt sau vào của sổ editor của matlab 7.0..nó ko chạy:
funtion [p1,err,k] = newtonraphson(f,df,po,delta,max1)
f=inline('sin(tan(x))-tan(sin(x))','x');
df=inline('cos(tan(x))/(cos(x).^2)-cos(x)/(cos(sin(x)).^2)','x');
po=input('po=');
delta=input('delta=');
max1=input('max1=');
for k=1:max1
p1=po-f(po)/df(po);
err=abs(p1-po);
po=p1;
if (err<delta),break,end
end
của sổ matlat hiện ra thông báo"Undefined command/function 'funtion'.
e ko hiểu tại sao lại như vậy nữa
hj,chắc là e nhầm topic nên ko có ai trả lời giùm
Comment
-
Bạn dùng phương thức nén ảnh nào? Nếu như đầu bài không yêu cầu cụ thể thì đơn giản nhất là dùng DCT (discrete cosine transform). Cách thức nén ảnh ở phương pháp này như sau: ví dụ ảnh ban đầu là ảnh đen trắng, mỗi pixel có giá trị từ 0(đen)->255(trắng) (có 256 levels) -> cần tối đa 8 bit để biểu diễn 1 pixel ảnh (2^8=256 levels). Đặt ra các mức ngưỡng ví dụ 0<A(i,j)<10 thì A(i,j)=0; 11<A(,i,j)<20 thì A(i,j) = 2;.... ;251<A(i,j)<255=25. Như vậy ảnh mới chỉ có 25 levels-> chỉ 5 bits để biểu diễn 1 pixel.Nguyên văn bởi edgar.bmt Xem bài viếttình hình là mình được giao về viết một hàm nén ảnh dùng matlab. Có ai biết gì về vấn đề này không? Giúp mình với!!
Comment
-
1/ Em muốn hỏi về cách lập trình vẽ đồ thì của hàm số y=ax^4-bx^3+cx^2+dx+e trong M-file.
với các số a,b,c,d,e là số bất kỳ sẽ đc nhập vào trong command window
Và tìm ước số chung của 2 số a và b.
Em thử dùng input như này thì khi ra command window gõ :
>>fplot('test',[-6,6])
Thì nó cứ bắt nhập các số a,b,c,d,e hoài vậy.
Còn tìm ước của 2 số thì em chẳng biết phải làm như nào
Cả nhà giúp em với . Em xin cảm ơn trc hì hì :xfunction y=test(x)
a=input('a=');
b=input('b=');
c=input('c=');
d=input('d=');
e=input('e=');
Y=a*x^4-b*x^3+c*x^2+d*x+e;Last edited by chánh; 24-06-2010, 00:06.
Comment
-
pro nào giúp em bài này với, em mới học matlab: "Viết chương trình matlab để vẽ tín hiệu x(t)=r(t).(u(t)-u(t-1)), sử dụng phép dịch tín hiệu trong đó u(t) là tín hiệu bước nhảy đơn vị (unit step) và r(t) là tín hiệu dốc( unit ramp)"
Thank nhìu nha!!
Comment
-
bác inychi19889 đang dùng win 7 muốn cài Mablat thì lên mạng load bản RA2009 về cài là Ok. mình cũng đang dùng..chạy ngon lắm
Với mình..riêng môn Matlab này ..cái nào không biết thì lên trường tìm thầy chuyên về điều khiển tự động mà hỏi..vừa tiết kiệm thời gian..có khi lại được mấy thầy cô chỉ thêm
quá đã
Comment
Bài viết mới nhất
Collapse
-
bởi FotiniChào mọi người.
Cấu trúc khung giàn của tôi sử dụng một động cơ servo tích hợp trên mỗi trục (https://www.oyostepper.es/category-8...integrado.html), với một dây nối đất chung.
Việc kích hoạt từng trục riêng lẻ hoạt động tốt, nhưng...-
Channel: Điện tử dành cho người mới bắt đầu
18-06-2026, 14:03 -
-
Trả lời cho Cấu hình chiến game "quốc dân" cho nền tảng AM5: Lựa chọn tối ưu ngân sách với Ryzen 5 7500Fbởi kumarbrMình đồng ý với hướng build AM5 bằng 7500F, nhưng nếu có thể cố thêm ngân sách thì nên lên RX 7600 ngay từ đầu. 4GB VRAM của RX 6500 XT bắt đầu khá chật với nhiều game mới, còn RX 7600 sẽ dùng thoải mái hơn trong vài năm tới.
-
Channel: Đánh giá sản phẩm DTVN
16-06-2026, 15:49 -
-
bởi theidiotcatTrong thời buổi vật giá leo thang, việc sắm một bộ máy tính chơi game đáp ứng đủ tiêu chí "ngon, bổ, rẻ" là ưu tiên hàng đầu của nhiều bạn trẻ. Lúc này, combo sử dụng vi xử lý AMD Ryzen 5 7500F kết hợp cùng card màn hình Radeon...
-
Channel: Đánh giá sản phẩm DTVN
16-06-2026, 10:16 -
-
bởi theidiotcatAMD Ryzen 9 9950X3D không chỉ là một bộ vi xử lý đơn thuần; nó là lời khẳng định về sức mạnh của kiến trúc Zen 5 kết hợp cùng công nghệ 3D V-Cache đột phá. Trong bối cảnh thị trường linh kiện PC cạnh tranh khốc liệt, đây được xem...
-
Channel: Đánh giá sản phẩm DTVN
15-06-2026, 09:21 -
-
bởi theidiotcatBộ đôi Ryzen 9 9950X3D2 và Radeon RX 9070 XT 16GB là sự kết hợp phần cứng cao cấp nhất của AMD hiện nay. Đây không chỉ là một dàn máy tính để giải trí thông thường, mà là công cụ làm việc mạnh mẽ dành cho những ai có nhu cầu xử lý cường...
-
Channel: Đánh giá sản phẩm DTVN
15-06-2026, 09:09 -
-
bởi theidiotcatKhi ráp một bộ máy tính cấu hình cao, việc cân đối ngân sách cho từng linh kiện là rất quan trọng. Sự kết hợp giữa vi xử lý AMD Ryzen thế hệ mới có công nghệ 3D V-Cache và card đồ họa Radeon RX 9070 XT đang là lựa chọn rất đáng tiền....
-
Channel: Đánh giá sản phẩm DTVN
11-06-2026, 10:43 -
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92Giới thiệu bản nhạc đệm mới nhộn nhịp tươi vui, nghe là muốn... xuất gia đi tu liền!!!!😁...
-
Channel: Tâm tình dân kỹ thuật
11-06-2026, 09:51 -

Comment