4 views (last 30 days)

Can anyone tell me why the 2 scripts that i attached are giving different outputs for the same inputs?

They should be doing exactly the same and it's crushing my brains.

The second script also seems to be slower and it's graph is less good than the first script, I have no clue why.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 6 Comments

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785207

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785207

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785210

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785210

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785261

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785261

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785262

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785262

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785263

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785263

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785265

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/499882-can-anyone-tell-me-why-the-2-scripts-that-i-attached-are-giving-different-outputs-for-the-same-input#comment_785265

Sign in to comment.