Unrecognized function or variable 'X', where is the error ? I have tired all the things and solution but the problem wont fix , please help its urgent Thank you
4 views (last 30 days)
Show older comments
Answers (1)
Geoff Hayes
on 1 Apr 2020
harshit - you are calling your function, from the command line as
>> computeCost(X, y, theta)
which is fine as it does match the signature of this function in so much as it requires three input parameters/variables. But have you defined these variables prior to trying to use them? The error message is telling you that you haven't (i.e. you are trying to use a variable that does not exist). You would need to define this as
>> X = 1:1:10;
>> y = sin(X);
>> theta = 42;
>> computeCost(X, y, theta)
Note that the above values I've assigned to these three variables are for example purposes only. I don't know what the correct values should be...
0 Comments
See Also
Categories
Find more on FPGA, ASIC, and SoC Development in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!