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
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92Dạ, cảm ơn bác đã nghe qua và có lời khích lệ cháu ạ.
Thật lòng cháu không dám nhận hai danh hiệu Kỹ sư và Nhạc sĩ đâu ạ, vì phải thật hiểu sâu nắm vững cơ, chứ thực lực cháu đây chỉ là biết chút ít thôi à. Về phần...-
Channel: Tâm tình dân kỹ thuật
29-01-2026, 11:58 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi bqvietĐơn giản thì có trải nghiệm này
http://www.dientuvietnam.net/forums/...ch%C3%AA%CC%81
Chỉ phần cứng,...-
Channel: Điện tử công suất
27-01-2026, 21:32 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi Nexus 6Pphức tạp quá, nếu mà có mạch làm sẵn thì ngon, e dùng 2 tấm pv loại 18v 55w thôi bác
-
Channel: Điện tử công suất
26-01-2026, 08:52 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi Nexus 6Pcảm ơn bác nhiều nha, để e nghiên cứu
-
Channel: Điện tử công suất
26-01-2026, 07:38 -
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi vi van phamkỹ sư nhạc sĩ dinhthuong dạo này lên tay nghề khá quá.
-
Channel: Tâm tình dân kỹ thuật
25-01-2026, 21:29 -
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92Hát Mừng Sinh Nhật, sáng tác: HĐT, hòa âm-thể hiện: AI
-
Channel: Tâm tình dân kỹ thuật
24-01-2026, 22:13 -
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92Chào bác, gần Tết công việc bác bận lắm phải không?
Vâng mọi người đều thế cả.
Em mới trả phí cho nó 1 tháng, nhờ nó hát thử ấy ạ. Tiếc vì em đã dốt nhạc lí lại lười học nên sáng tác thì vụng về mà hát demo...-
Channel: Tâm tình dân kỹ thuật
24-01-2026, 21:53 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi bqvietCảm thấy cứng tay thì làm theo hướng dẫn khá chi tiết ở trang sau
https://www.instructables.com/DIY-1k...ge-Controller/-
Channel: Điện tử công suất
23-01-2026, 16:50 -
-
bởi Nexus 6PNhư tiêu đề, các bác giới thiệu e mạch sạc nlmt mppt có chức năng chỉnh dòng với, tấm PV của em 18V 55W, dùng để sạc cho khối pin sắt 3.2V 45A (sắp tới sẽ thay bằng ắc quy 12V)
e cảm ơn-
Channel: Điện tử công suất
23-01-2026, 11:23 -

Comment