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 chinhnguyen9Công thức
Gain (dB) = 20 × log₁₀(A)
Thí dụ 1; 60dB
log₁₀(A)=60/20=3
⇒ A=V_out / V_in = 10³ = 1.000
Thí dụ 2; 100dB
log₁₀(A)=100/20=5
⇒ A=V_out / V_in = 105 = 100.000
Tí dụ 3; LM 358
Large Signal Open Loop Voltage Gain AVOL V/mV RL = 2.0...-
Channel: Hướng dẫn sử dụng diễn đàn
hôm nay, 08:44 -
-
Trả lời cho Mạch 3s bị giảm điện áp đầu rabởi minhtri0405chả biết bạn xử lý được chưa , kích sạc hoặc điện áp > điện áp khối pin vào 2 chân P - P+ , nhiều mạch phải yêu cầu có kích lần đầu sau đó mới chạy...
-
Channel: Điện tử dành cho người mới bắt đầu
Hôm qua, 10:01 -
-
bởi minhtri0405đây có phải là 1 cách để test mosfet xịn hay dỏm khi mua đồ tàu không nhỉ , vì ko thể đập ra để coi lõi rồi trả hàng được....
-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 09:57 -
-
Trả lời cho Giúp mình vẽ sơ đồ và phân tích nguyên lý làm việc của khảo sát các mạch nguồn ổn áp vớibởi Tuyenvc345
-
Channel: Hỗ trợ học tập
16-03-2026, 18:05 -
-
Trả lời cho Giúp mình vẽ sơ đồ và phân tích nguyên lý làm việc của khảo sát các mạch nguồn ổn áp vớibởi Tuyenvc345
-
Channel: Hỗ trợ học tập
16-03-2026, 18:04 -
-
bởi bqvietDiễn đàn vốn vắng, muốn vào viết bài trả lời chút nhưng cứ thấy luồng nào thành viên này mở thì cũng đồng thời xuất hiện ở Otofun, thế là chùn tay ... Thôi thì dientuvietnam không thể so sánh được về độ phổ cập, biết thân biết phận vậy.
-
Channel: Tâm tình dân kỹ thuật
16-03-2026, 17:49 -
-
bởi chinhnguyen9So sánh sóng 2 mạch nguồn Push-pull
· Sóng vuông giửa 2 cực D của mạch Pushpull trong module inverter 24-220V sine giả của TQ. Mạh điện này khá đặc biêt ở chổ, không thấy mạch snubber mà hiêu quả triêt sóng hài quá tốt dù hoạt...-
Channel: Nguồn!
16-03-2026, 14:27 -
-
bởi chinhnguyen9Mạch điên bếp tù gộm 2 khối:
Khối điêu khiển:
-Thiết lập công suất nấu
-Thiết lập thời gian nấu
-Kiểm tra có đặt nồi hay không, đúng loại hay không?
-Có quá nhiệt không?
Khối công suất:
- Nắn+ lọc điên AC ra 310VDC +loọc nhiểu...-
Channel: Hướng dẫn sử dụng diễn đàn
16-03-2026, 14:05 -

Comment