Unrecognized function or variable

107 views (last 30 days)
Kutlu Yigitturk
Kutlu Yigitturk on 15 Mar 2021
Commented: Image Analyst on 28 Mar 2022
clear all
clc
range = 1;
t = -range:0.01:range;
w = 1;
P = unit(t+w/2)-unit(t-w/2);
plot(t,P,'Linewidith',5)
grid on
axis([-range-1 range+1 0 1])
title('Rectangel Function');
xlabel('Time(sec)');
ylabel('p(t)');
line([0 0],ylim,'color','r', 'Linewidth',2)
line(xlim,[0 0],'color','r', 'Linewidth',2)
The error I get is as follows. I don't know how to fix this problem. Thank you in advance for your help.
  3 Comments
Image Analyst
Image Analyst on 28 Mar 2022
@SALINI BALASUBARAMANIUM , not sure how your code fixes the "Unrecognized function or variable" error that was mentioned in this year-old question where the user was tring to implement the Heaviside step function. Did you post it here by mistake?

Sign in to comment.

Answers (3)

the cyclist
the cyclist on 15 Mar 2021
To my knowledge, there it no MATLAB function named unit().
I also used the search bar in the documentation, and did not find anything.
Where did you get this code? Maybe you are missing a second file, that has a user-defined function with that name?
  3 Comments
Kutlu Yigitturk
Kutlu Yigitturk on 15 Mar 2021
Thank you for your attenton. I fixed the problem with unusually way. I show the solution top side.

Sign in to comment.


Image Analyst
Image Analyst on 15 Mar 2021
Why did you think it knows what unit is? It does not.
If, by chance, you want to convert to integer use uint32() instead of unit(). Be careful of the location of the "i" and the "n".
  3 Comments
Kutlu Yigitturk
Kutlu Yigitturk on 15 Mar 2021
Thank you for your attenton. I fixed the problem with unusually way. I show the solution top side.

Sign in to comment.


Ronielson LIma
Ronielson LIma on 2 Nov 2021
Good Nitght.
Can you help me please.
Unrecognized function or variable 'distinguishable_colors'.
Error in drawPR (line 8)
methods_colors = distinguishable_colors(length(methods));
  3 Comments

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!