Error: Undefined function or variable linspace [closed] - matlab

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When I am trying to use linspace in MATLAB I am getting the above error. How do I resolve it?
I am using linspace in a very simple statement:
t= linspace(0,8760,876);

Why don't you try to check internal matlab path? If you get that error is because Matlab cannot find the definition of the function. Thought it is weird as it is a basic function.

It's probably a path issue. Run restoredefaultpath.

Related

I can't find all the errors occurring in my codes [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
For matalb there's an error at line 9, where I define dy(1), but it doesn't say what kind of error.
function dy=pred_prey(t,y)
k=1;
a=2/3;
d=4/3;
f=#(x)cos(x.^2)
r=#(t)integral(f,0,t);
mu=#(t)13/20-(3/5)*exp(-(3/t));
dy(1)=(y(1)+k)*r-a*y(1)*y(2);
dy(2)=-mu*y(2)+d*y(1)*y(2);
dy=dy';
You define r as an anonymous function, but you don't pass any arguments to it when you call it on line 9. The line should be (I assume):
dy(1) = (y(1)+k)*r(t)-a*y(1)*y(2);
Incidentally, you're going to have the same problem on the next line where you call mu with no arguments as well.

Matlab variable name: input character is not valid in MATLAB statements or expressions [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I 'm using this 720_15_LDP_OFF_values as matrix name in Matlab 2015b but I get the following error:
The input character is not valid in MATLAB statements or expressions.
From the MATLAB documentation:
A valid variable name starts with a letter ... .
But your variable started with a digit.

why I can't use function readframe in matlab [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I write this code but have error "Undefined function 'readframe' for input arguments of type 'VideoReader'"
How to I will solve? thank you.
v = VideoReader('filename.avi');
video = readframe(v,1);
figVid = figure();
axeVid = axes('Parent', figVid);
image(video, 'Parent', axeVid);
Actual Answer: The function is readFrame() not readframe().

MATLAB plotting syntax error? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I watched a video titled "Writing a matlab program" and tried to use the syntax exactly, yet I still can't see how I've made an error...can you please help?
My code is simply
x= [-10:0.1:10];
y=2x^2-x + 1;
plot (x,y)
I'm getting a parse error at x and I have no idea what that means..
Matlab cannot parse 2x. Multiplication requires the * symbol. Either * or .* will work in this case.
Your next problem will be the use of ^ instead of .^ —this time you're going to have to include the dot. Google for "elementwise" operators in matlab to understand what difference the dot makes.

Distance measurement in Matlab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have tried the code from the link Ear Image Processing - Finding the point of intersection of line and curve in MATLAB
but seem to get an error as dist2s is undefined on matlab R2013a.Can anyone help me out
That's because you need to create the function (isn't defined by MatLab itself). Try saving this code in a file called dist2s.m and then setting the folder where it's located like current folder:
function out = dist2s(pt1,pt2)
out = NaN(size(pt1,1),size(pt2,1));
for m = 1:size(pt1,1)
for n = 1:size(pt2,1)
if(m~=n)
out(m,n) = sqrt( (pt1(m,1)-pt2(n,1)).^2 + (pt1(m,2)-pt2(n,2)).^2 );
end
end
end
return;
The code is provided in the same answer you refer to.