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

Answers (1)

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...

Categories

Find more on FPGA, ASIC, and SoC Development in Help Center and File Exchange

Asked:

on 1 Apr 2020

Answered:

on 1 Apr 2020

Community Treasure Hunt

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

Start Hunting!