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
-
Nguyê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
-
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
function 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 Giúp em về mạch MPPT và Solar Panel với!?bởi tuyennhanBác tìm coi mấy cái clip về tai nạn hàng không sẻ sáng tỏ nhiều điều ......
-
Channel: Điện tử công suất
hôm nay, 11:02 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi tuyennhanChính xác mua tại hãng và mua qua đại lý khác nhau rất nhiều về giá và chất lượng ....
-
Channel: Điện tử công suất
hôm nay, 10:51 -
-
Trả lời cho Xin giúp đỡ mạch chuông trò chơi ạ !!bởi DessrtTôi đồng ý, điều này thực sự thú vị....
-
Channel: Hỗ trợ học tập
Hôm qua, 22:08 -
-
Trả lời cho Năm mới dientuvietnam.netbởi mèomướpDạ năm mới cháu xin kính chúc ông, bà, cô, dì, chú, bác, anh, chị, em, các bạn, các cháu... trong diễn đàn sức khỏe dồi dào, gặp nhìu may mắn và thành công...
-
Channel: Tâm tình dân kỹ thuật
30-01-2025, 05:42 -
-
Trả lời cho Năm mới dientuvietnam.netbởi nhathung1101Chúc cả nhà ăn no mặc ấm, quần lúc có lúc không.
-
Channel: Tâm tình dân kỹ thuật
30-01-2025, 00:02 -
-
Trả lời cho Năm mới dientuvietnam.netbởi vandong1111Năm mới 2025 cháu chúc các chú, các bác mạnh khỏe, vui vẻ, gặp nhiều may mắn.
-
Channel: Tâm tình dân kỹ thuật
29-01-2025, 20:59 -
-
Trả lời cho tìm mua đồng hồ vạn năngbởi bqvietNói một cách xây dựng thì kiểu đồng hồ kiêm kẹp dòng NJTY3266 mà bạn Mèo đề cập là đúng nhu cầu người hỏi rồi. Một số cửa hàng bán trên 200ng, vài sàn thương mại điện tử bán dưới - thế là đúng nhu cầu về giá. Nếu khéo săn...
-
Channel: Điện tử dành cho người mới bắt đầu
27-01-2025, 20:02 -
-
Trả lời cho tìm mua đồng hồ vạn năngbởi nhathung1101Đa năng còn chưa dùng hết, nếu không biết cách dùng.
200k thì hơi khó mua, nhưng 50k chắc là có. Cứ bảo bán cho tôi cái đồng hồ hỏng.-
Channel: Điện tử dành cho người mới bắt đầu
26-01-2025, 23:21 -
-
Trả lời cho Sửa bộ nguồn DC 60V 45Abởi nhathung1101Lão Đinh Vặn học giải phương trình hồi đi trẻ mà. Mẫu giáo học lập trình AI rồi. Lớp lão ấy gần lớp em nên em biết....
-
Channel: Điện tử công suất
26-01-2025, 23:11 -
-
Trả lời cho Giúp em về mạch MPPT và Solar Panel với!?bởi nhathung1101Vậy chú đã hỏi hãng SIEMEN chưa? Tại sao cái PLC S7-200 cổ lỗ mà họ vẫn thiết kế riêng cho thị trường TQ với chữ SMART? Thậm chí phần mềm riêng để đọc file ngu.smart?
Vấn đề không còn là công nghệ "cốt lõi" nữa, mà là giá thành quyết định. Ham rẻ là trả giá mà....-
Channel: Điện tử công suất
26-01-2025, 23:01 -
Comment