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
-
bởi Trắng bạchem đang làm cái đồ án sử dụng pid để điều khiển Động Cơ DC Servo Giảm Tốc GA25 12v/280rpm, dùng winform truyền xuống pic16f877a các thông số vận tốc, ki, kd, kp. hiện tại em đã truyền xuống được nhưng truyền xuống vài lần là giao diện...
-
Channel: Hỗ trợ học tập
Hôm qua, 23:46 -
-
Trả lời cho Dùng MC34063 để làm driver lái led 1W, 3Wbởi nhathung1101Dự là bạn này định chế đèn led cho oto.
không hiểu các bạn hiểu về đèn led thế nào? chỉ mong các bạn hiểu cuộc sống chỉ có một lần thôi.-
Channel: Điện tử dành cho người mới bắt đầu
19-05-2024, 22:29 -
-
Trả lời cho Dùng MC34063 để làm driver lái led 1W, 3Wbởi bqvietChỗ đó là chỉ IC này chạy DC (tất nhiên) được mà AC cũng được. Khi chạy điện AC thì cần cầu nắn dòng và tụ lọc 100uF. Nếu chạy DC thì không cần cầu nắn mà tụ đó cũng chỉ cần tầm vài uF thôi. Cái đi-ốt thì càng dễ, luận tí...
-
Channel: Điện tử dành cho người mới bắt đầu
19-05-2024, 21:37 -
Comment