Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Help with iteration problem

Asked by mohsen on 19 Nov 2012

>> x=0.7; % x is fixed value

>> syms s % s is symbols

>> v=char(x./(s^2+1)); % v is function of (x,s)

% numerical method to compute inversion Laplace transformation

% this function is available through remark at below

>> [t1,ft1]=INVLAP(v,0.0001,5,1000,6,39,89);

>> plot(t1,ft1)

please, help me the previous small code run easily, but i need (x not equal fixed), i.e., i need x- run over the interval (0:0.1:1), and also make all the following steps, then make 3-D figures between mesh(x,t1,ft1)

% remark

% INVLAP Numerical Inversion of Laplace Transforms

http://www.mathworks.com/matlabcentral/fileexchange/32824-numerical-inversion-of-laplace-transforms-in-matlab/content/INVLAP.m

1 Comment

mohsen on 20 Nov 2012

thank u, i do the step which u refer to it in your answer but their exist error and the following message is appeared

??? Error using ==> mesh at 80

Z must be a matrix, not a scalar or vector.

code according to your vision

for x=0:0.1:1;

syms s % s is symbols

v=char(x./(s^2+1)); % v is function of (x,s)

% numerical method to compute inversion Laplace transformation

% this function is available through remark at below

[t1,ft1]=INVLAP(v,0.0001,5,1000,6,39,89);

end

mesh(x,t1,ft1)

mohsen

Products

No products are associated with this question.

1 Answer

Answer by bym on 19 Nov 2012

seems like a simple 'for loop' would do the trick

x = 0:.1:1;
for x
  v=char(x./(s^2+1)); % v is function of (x,s)
  % modify call to INVLAP to store ft1 in a matrix
  ...
end
mesh(...)

2 Comments

mohsen on 20 Nov 2012

thank u, i do the step which u refer to it in your answer but their exist error and the following message is appeared

??? Error using ==> mesh at 80

Z must be a matrix, not a scalar or vector.

code according to your vision

for x=0:0.1:1;

syms s % s is symbols

v=char(x./(s^2+1)); % v is function of (x,s)

% numerical method to compute inversion Laplace transformation

% this function is available through remark at below

[t1,ft1]=INVLAP(v,0.0001,5,1000,6,39,89);

end

mesh(x,t1,ft1)

bym on 20 Nov 2012

yes, that is why I put in my answer the comment

% modify call to INVLAP to store ft1 in a matrix
bym

Contact us