필터 지우기
필터 지우기

no sinusoidal perturbation, the initial condition does not appear in the result, I could not figure out the problem.

조회 수: 1 (최근 30일)
I have problem that the initial condition fr = 0.05 +0.0001*(1+sin(k*x));fl,.. and the others did not show any sinusoidal perturbation. If I wrote the initial condition asfr = @(x) 0.05 +0.0001*(1+sin(k*x)); the code works. However if I delete @(x) d
oes not work.

답변 (1개)

SAI SRUJAN
SAI SRUJAN 2023년 10월 4일
Hi lulu,
Based on my comprehension of the question,the initial condition "fr = 0.05 +0.0001*(1+sin(k*x))" is not showing any sinusoidal perturbation,whereas the initial condition "fr = @(x) 0.05 +0.0001*(1+sin(k*x))" works as expected.
The initial condition "fr = 0.05 +0.0001*(1+sin(k*x))" creates a 1x101 double vector.The following errors have been encountered after running "code.m".
Similarly the initial condition for "gr =0.0+0.0001*(1+sin(k*x))" which creates a 1x101 double vector.As seen from the above picture,we can see that error occured at line 115 which traces back to line 88.In line 88, the use of "gr(x)" is causing the issue, inorder to access a value of an array the index must be a positive integer.This condition is failed as the propogated "x" value in line 88 is not an integer.
In contrast, the initial condition "fr = @(x) 0.05 +0.0001*(1+sin(k*x))" creates a function handle. This code performs as anticipated, as the function handle operates effectively with both double and integer parameters in the provided code.

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by