dx/dt=-0.15*y(t)
dy/dt=-0.1x(t)
x(0)=10000;y(0)=5000
这个微分方程用MATLAB怎样求解啊!
有谁能够写出PCL-818数据采集卡的采集数据(温度)的原代码.
我急需!!!!
[此贴子已经被作者于2007-5-15 0:45:50编辑过]
程序编出来了,调试怎么也过不了,希望哪位大虾帮忙调试一下!
u,v,ed,E矩阵需要预定义吗?怎么预定义?
tic;
clear;clc;
epsilon=8.9e-12; num=21; a=0.2/(num-1); t=(num+1)/2;cons=300;
dp1=0.1;pg=1.025;ki=2.2e-4;
v(t,t)=6e4;v1=u;N=0;
while max(max(abs(v-v1)))>cons;
N=N+1;
v1=v;
for i=2:num-1
for j=2:num-1
Eox=-(v(i-1,j)-v(i+1,j))/(2*a);
Eoy=-(v(i,j-1)-v(i,j+1))/(2*a);
E(i,j)=sqrt(Eox.^2+Eoy.^2);
u(i,j)=0.25*(v(i,j-1)+v(i,j+1)+v(i-1,j)+v(i+1,j)+a^2*ed(i,j)/epsilon);
ed(i,j)=-epsilon/(2*a)*(Eox+Eoy)-0.5*((epsilon/a*(Eox+Eoy))^2
+4*(epsilon/a*(Eox*ed(i+1,j)+Eoy*ed(i,j+1))))^0.5;
u(1,:)=0;u(num,:)=0;u(:,num)=0;u(t,t)=6e4;ed(t,t)=3e-5;
end;
end;
v=u;
end;
d=[0:0.2/(num-1):0.2];
[x,y]=meshgrid(d);
u=abs(u);ed=abs(ed);E=abs(E);
figure(1);surfl(x,y,abs(u));
figure(2);surfl(x,y,abs(ed));
figure(3);surfl(x,y,abs(E));
toc
[此贴子已经被作者于2007-5-20 15:57:07编辑过]
我是一个新人,不怎么会编程,下面这个程序的错误在什么地方,帮忙看下
p(1)=0;
for t=2:512
p(t)=0.99*p(t-1)+sin^2*(800*t);
end
plot(p(t))
运行后提示是
??? Error using ==> sin
Not enough input arguments.
Error in ==> sin at 14
[varargout{1:nargout}] = builtin('sin', varargin{:});
Error in ==> l at 3
p(t)=0.99*p(t-1)+sin^2*(800*t);
你好,能解释一下以下gui个部分的功能吗
function varargout = eggui3(varargin)
% EGGUI3 M-file for eggui3.fig
% EGGUI3, by itself, creates a new EGGUI3 or raises the existing
% singleton*.
%
% H = EGGUI3 returns the handle to a new EGGUI3 or the handle to
% the existing singleton*.
%
% EGGUI3('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in EGGUI3.M with the given input arguments.
%
% EGGUI3('Property','Value',...) creates a new EGGUI3 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before eggui3_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to eggui3_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help eggui3
% Last Modified by GUIDE v2.5 25-Oct-2006 20:33:17
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @eggui3_OpeningFcn, ...
'gui_OutputFcn', @eggui3_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before eggui3 is made visible.
function eggui3_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to eggui3 (see VARARGIN)
% Choose default command line output for eggui3
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes eggui3 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = eggui3_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function zeta_edit_Callback(hObject, eventdata, handles)
% hObject handle to zeta_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of zeta_edit as text
% str2double(get(hObject,'String')) returns contents of zeta_edit as a double
z=str2num(get(handles.zeta_edit,'string'));
t=0:0.1:15;
cla;
%plot(t,sin(t));
for k=1:length(z)
y(:,k)=step(1,[2*z(k),1],t);
line(t,y(:,k));
end
% --- Executes during object creation, after setting all properties.
function zeta_edit_CreateFcn(hObject, eventdata, handles)
% hObject handle to zeta_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in gridon_push.
function gridon_push_Callback(hObject, eventdata, handles)
% hObject handle to gridon_push (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
grid on;
% --- Executes on button press in gridoff_push.
function gridoff_push_Callback(hObject, eventdata, handles)
% hObject handle to gridoff_push (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
grid off;
% --------------------------------------------------------------------
function option_Callback(hObject, eventdata, handles)
% hObject handle to option (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Box_on_Callback(hObject, eventdata, handles)
% hObject handle to Box_on (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
box on;
% --------------------------------------------------------------------
function Box_off_Callback(hObject, eventdata, handles)
% hObject handle to Box_off (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
box off;
各位高手.小弟我是新手入门了.想请教下.
如果我在matlab 编程中需要读取一些数据,,我要的只是数据,而不要用到前面的文件头啊..所以想在编程的时候在读取数据的时候把这些自动去掉...该怎么做啊~~(像这样的数据不只是一个..而是有很多个,所以手动删取是不可以的)这些数据是是如下:
#[FileName]
#FileName=D:\data\ww\0527\bk_40000.arc_data
#Map FileName=D:\data\zgp\526\2-2.arc_map
#Map Area Number=1
#TimeStamp=05-5-27 15:33:13
#[CCD]
#Interface=PCI Timer Card
#Controller=ST133
#CCDHead=HAMAMATSU 128 x 1024
#Mono_1_Present=true
#Mono_2_Present=false
#FilterWheel_1_Present=false
#FilterWheel_2_Present=false
#[CCD_Acquisition]
#TimeTaken=05-5-27 15:32:58
#DataCalc=ch1
#WaveUnits=nm
#Cycles=1
#DataSource=Area_Map_Profile
#IntegrationTime=40000
#HeadTemp=-34.5
#TempLocked=0
#AtoD=slow
#[CCD_Strips]
#Number_of_Strips=1
#[CCD_Strip_1]
#Startx=1
#Endx=1024
#Starty=1
#Endy=128
#[CCD_Mono3080650]
#Model=SP-308
#Serial=3080650
#WaveLength=5400000
#Grating=2
#Grating_Density=1200
#Grating_Blaze= 500 nm
#Entry=side
#EntryWidth=10
#Exit=front
#ExitWidth=0
# X Y
510.5755008 2842
510.6316334 2895
510.6877639 3008
510.743892 3035
510.800018 3030
510.8561416 3055
510.912263 3230
510.9683822 3211
511.024499 3273
511.0806137 3266
511.136726 3388
511.1928361 3307
511.248944 3328
511.3050495 3473
511.3611528 3411
511.4172539 3418
511.4733526 3396
511.5294491 3376