how to give param value

조회 수: 10 (최근 30일)
juveria fatima
juveria fatima 2018년 11월 30일
편집: Walter Roberson 2021년 11월 15일
how to give a,b,c,d,dt value to function
function [X1,Y1,Z1,W1] = Rossler4D(x,y,z,w,param)
a = param.a;
b = param.b;
c = param.c;
d = param.d;
dt= param.dt;
X1 = x + dt*(-y-z);
Y1 = y + dt*(x + a*y +w);
Z1 = z + dt*(b+x.*z);
W1 = w + dt*(-c.*z+d.*w);
end
% a: 0.2500
% b: 3
% c: 0.5000
% d: 0.0500
% dt: 0.0025

채택된 답변

Walter Roberson
Walter Roberson 2018년 11월 30일
param.a = 0.2500;
param.b = 3;
param.c = 0.5000;
param.d = 0.0500;
param.dt = 0.0025;
[X1,Y1,Z1,W1] = Rossler4D(x,y,z,w,param);
Or you could use
param = struct('a', 0.2500, 'b', 3, 'c', 0.5000, 'd', 0.0500, 'dt', 0.0025);
[X1,Y1,Z1,W1] = Rossler4D(x,y,z,w,param);
  댓글 수: 2
juveria fatima
juveria fatima 2018년 11월 30일
@ Walter thank you, this is what i wanted to do.
Ghofran Khaled
Ghofran Khaled 2021년 11월 15일
could you help me please
my question here
https://ww2.mathworks.cn/matlabcentral/answers/1586514-how-can-i-create-improved-lorenz-mapping-code

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

madhan ravi
madhan ravi 2018년 11월 30일
편집: madhan ravi 2018년 11월 30일
EDITED
x=-10;
y=-6;
z=0;
w=10;
a= 0.2500;
b= 3;
c= 0.5000;
d= 0.0500;
dt= 0.0025;
[X1,Y1,Z1,W1] = Rossler4D(x,y,z,w,a,b,c,d,dt) %function call
function [X1,Y1,Z1,W1] = Rossler4D(x,y,z,w,a,b,c,d,dt) %this is how
X1 = x + dt*(-y-z);
Y1 = y + dt*(x + a*y +w);
Z1 = z + dt*(b+x.*z);
W1 = w + dt*(-c.*z+d.*w);
end
  댓글 수: 2
madhan ravi
madhan ravi 2018년 11월 30일
see edited answer
Ghofran Khaled
Ghofran Khaled 2021년 11월 15일
편집: Walter Roberson 2021년 11월 15일

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by