MATLAB Answers

0

problem in creating function

Why?
unction r=kalpa(x)
r=x^2;
end
Capture.JPG

  0 Comments

Sign in to comment.

1 Answer

Answer by KALYAN ACHARJYA on 29 Aug 2019
Edited by KALYAN ACHARJYA on 29 Aug 2019
 Accepted Answer

First you have to create the function and save in different Matlab file, the file name must be same as function name, in your case kalpa.m
Next call the function (by passing x value to the function file) from commnad widow or from another Matlab script.
like
y=kalpa(10)
% here y will return as 100
Hera Hazarika, I hope you get the point.

  3 Comments

thank you. I know this. But my problem was not because of what you have mentioned but because of not passing the argument through the RUN button(inside therun button one must input the arguments then it will work)
madhan ravi
on 2 Sep 2019
That's what Kalyan implies "Next call the function (by passing x value to the function file) from commnad widow or from another Matlab script."
@Madhan.. Always..Thanks

Sign in to comment.