http://blog.sina.com.cn/zhangfujian[订阅]
个人资料
分类
    内容读取中…
音乐播放器
博文

//退出Acrobat弹出错误,无数次了,今天终于受不了了,找到了官网上的解决方案。

Error 'the application is being terminated because of memory corruption' when you exit Acrobat 7 (on Windows)

Issue

When you exit Acrobat 7, Acrobat returns the error message,'the application is being terminated because of memory corruption.'

Solutions

Do one of the following solutions:

Solution 1: Install the Acrobat 7.0.8 update.

If you have Acrobat 7.0, choose Help > Check For Updates Now to install the update. Alternately, you can download the update from the Adobe website at www.adobe.com/downloads/ .

 

//经常要用,还经常忘的。   

 

    set(gcf,'color','w')
    set(gca,'fontsize',12);
    set(gca,'linewidth',1);

//from matlab help document.

// As a reminder.

 

Using the Distributions with Command-Line Functions


You can specify the distributions described in this section when using the functions mle, cdf, icdf, and pdf. To do so, set the first argument of the function to one of the following distribution names: 'birnbaumsaunders' 'inversegaussian' 'loglogistic' 'nakagami' 'rician' 'tlocationscale'

matlab FAQ(2009-09-19 10:18)

//来自matlab central

Authored by the MATLAB and Simulink user community on the MATLAB Wiki.

Table of contents [showhide]

//原创为 hyl2323@chinavib ,原帖子地址http://www.chinavib.com/forum/viewthread.php?tid=56775

//由于时不时有人会被问到fft的横坐标的问题,觉得这个myfft还是很方便的,就转帖一下吧。

 

function [X,f]=myfft(fs,x,fmax,p)
% myfft       my fft program based on matlab's fft
% [X,f]=myfft(fs,x,fmax,p)
% inputs:     fs:sampling frequency
            x:analysed signal(vector)
            fmax:maximum frequency for display
       

今天论坛上的一个小问题,就是如何用
y1=@(x)(x^2+sin(x))*x^3
y2=@(x)cos(2+x^2)*x
创建y1-y2,也就是
y=@(x)(x^2+sin(x))*x^3-cos(2+x^2)*x
经过测试,可以采用如下的方式:
y1=@(x)(x^2+sin(x))*x^3;
y2=@(x)cos(2+x^2)*x;
y12=@(x)y1(x)-y2(x);

进而,想到另一个稍微复杂点儿的问题,就是复合函数的创建,也就是f(x)=g(u(x))。
其实,可以采用和上面的方法类似的方法就可以,下面是一个例子。
y1=@(x)(x^2+sin(x))*x^3;
y2=@(x)cos(2+x^2)*x;
y12=@(x)y1(y2(x));
很简单吧,呵呵。而且结合符号运算应该可以实现更多更方便的功能。

下面做个简单的例子验证一下正确性。

g=@(x)sin(x);
u=@(x)2*cos(x);
v=@(x)2*x;
fgv=@(x)g(v(x));fgv0=@(x)sin(2*x);fgu=@(x)g(x).*u

//转载自研学论坛。程序不是很难,但是能做这么漂亮就不容易了。

 

try %可以运行
close all
hfig=figure('visible','off');
set(hfig,'NumberTitle','off');
set(hfig,'name','My Clock');
set(hfig,'MenuBar','none');
set(hfig,'color',[0.5 0.7 0.3]);
set(hfig,'visible','on');
A=linspace(0,6.3,1000);
x1=8*cos(A);
y1=8*sin(A);

x2=7*cos(A);
y2=7*sin(A);
plot(x1,y1,'b','linewidth',1.4)
hold on
plot(x2,y2,'b','linewidth',3.5)
fill(0.4*cos(A),0.4*sin(A),'r');
axis off

axis([-10 10 -10 10])
axis equal
set(gca,'position',[[0.13 0.05 0.775 0.815]])
title(date,'fontsize',18)
for k=1:12;
xk=9*co

这次要接触一个新的求解ode的方法,就是使用simulink的积分器求解。

1.还是做我们研究过的一个例子(在初识matlab微分方程(2)中采用的)。

Dx=y+x(1-x^2-y^2);

Dy=-x+y*(1-x^2-y^2)

初值x=0.1;y=0.2;

积分器中设置初始条件;f(u)中指定Dx,Dy的计算公式。

运行这个仿真,scope中可以看到两个变量的时程如下:

在WorkSpace里可以得到tout和yout,执行plot(yout(:,1),yout(:,1))得到与ode45求解相似的结果如下

7.延迟微分方程

matlab提供了dde23求解非中性微分方程。dde23的调用格式如下:

sol = dde23(ddefun,lags,history,tspan)

lags是延迟量,比如方程中包含y1(t-0.2)和y2(t-0.3)则可以使用lags=[0.2,0.3]。

这里的ddefun必须采用如下的定义方式:

dydt = ddefun(t,y,Z)

其中的Z(:,1)就是y(t-lags(1)),Z(:,2)就是y(t-lags(2))...

下面是个使用dde23求解延迟微分方程的例子。

function mydde23study
  The differential equations
%
       y'_1(t) = y_1(t-1) 
       y'_2(t) = y_1(t-1)+y_2(t-0.2)
       y'_3(t) = y_2(t)
%
  are solved on [0, 5] with history y_1(t) = 1, y_2(t) = 1, y_3(t) = 1 for
  t <= 0.
clear;clc
lags=[1,0.2];
history=[1;1;1];
tspan=[0,5];
sol = dde23(@myddefun,lags,history,tspan)
plot(sol.x,sol.y)

function

论坛上的一个朋友问到了一个相关的问题,就做了一个小例子。还很粗糙,就看个意思吧。

 

function myCantileverBeam
clear;clc
global AA
x0=zeros(6*2,1);
x0(5)=0.3;x0(6)=0.1;
load AA.mat
tic
[t,x]=ode15s(@beamdx,[0,50],x0);
toc
subplot(321);plot(t,x(:,1))
subplot(322);plot(t,x(:,2))
subplot(323);plot(t,x(:,3))
subplot(324);plot(t,x(:,4))
subplot(325);plot(t,x(:,5))
subplot(326);plot(t,x(:,6))
% save x12.mat x t

function dx=beamdx(t,x)
E=2e11;
I=1/12*0.05*0.05^3;
A=0.05^2;
L=1;
N=2;
l=L/N;
rho=7800;
Ke=[E*A/l                      -E*A/l                 0
        12*E*I/l^3