Since you don't have any comments, I don't have a clue what your goal is. But the source of your problem is that you call the solver with 4 elements in y, but inside the solver you assume that there are 5.
Also, you seem to be repeating the same code several times, as well as repeating the nested function equation. And the clc;clear all; at the beginning of your code is useless (or at least the clear all is, since a function will start with an empty workspace anyway (unless you have input variables).
By the way: a clear all is a complete waste of time on top of a function. Why clearing an empty workspace? Removing all functions from the memory wastes time with reloading them from the slow disk.
The clear all does not avoid confusion, but is useless only. Keeping two functions with the same name and contents in the same file is confusing also, even if they are on different levels of nesting. This does not look like a "Dual solution concept", but like obfustcation. As you see, such tricks impede the debugging.
"Is not running" does not explain, what you observe. Please post this.
It is hard to modify the code, because you did not tell us, what the code should do. A not runnming piece of code keeps its purpose as secret, if the programmer did not inset exhaustive comments.
"it takes so much of run time" - please tell us any details: How much time does it need and what do you expect?
"Here is the qn with B.C for REF:(Dual solu needed)" - this sounds like pure magic to me. Please care for the non-native speakers like me and use full english words. Thank you.
After running the code for one value of x, say 1, we will get one solution and then we need to change the value of x,say , for 5, another solution(dual) came into picture.
I cannot run this code "for one value of x", because the formula does not contain any "x". Therefore I do not know, what changing its value to 5 is any kind of "dual". You cannot implement boundary conditions at Inf.
Sorry, MINATI, I do not get what you want to do. In your comment above (link) you wrote "running the code for one x", but the formula does not contain any "x". Then the explanation "we change the value of x (manually)" does not clarify my question.
@MINATI: Again and for the last time: The formula you have posted does not contain an "x". So you cannot run it with different values for x.
It is not efficient, if I watch internet videos about your problem, because it is your turn to understand the mathematical problem. This forum cares about the implementation in Matlab only. It is not clear to me, what the actual question is and you react to my questions for clarifications by repeating the formerly posted statements. This does not make the problem clear.
I suggest to drink a cup of coffee. Reformulate the problem. Post a minimal example, which demonstrates the problem and explain clearly, what you want to solve and what you observe. Maybe opening a new thread is a good idea, because this one is confusing now. If you do so, mention this thread as a link.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
21 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674562
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674562
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674571
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674571
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674714
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674714
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674952
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674952
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675117
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675117
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675248
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675248
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675285
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675285
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675321
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675321
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675325
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675325
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675326
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675326
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675335
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675335
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675352
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675352
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675364
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675364
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675369
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675369
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675374
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675374
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675416
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675416
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675504
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675504
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675670
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675670
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675788
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675788
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675918
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675918
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675933
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675933
Sign in to comment.