Error using plot Undefined function or variable 'newplot'.
15 次查看(过去 30 天)
显示 更早的评论
Hi,
I am using Matlab via Citrix. I am getting the following error while using plot function.
Error using plot in line 30
Undefined function or variable 'newplot'.
% Jake's Method
% close all;
clear all;
N=30;
M=0.5*(N/2-1);
wn(M)=0;
beta(M)=0;
ritemp(M,2001)=0;
rqtemp(M,2001)=0;
rialpha(1,2001)=0;
fm=[1 10 100];
Wm=2*pi*fm;
for i=1:3
for n=1:1:M
for t=0:0.001:2
Wn(n)=Wm(i)*cos(2*pi*n/N);
beta(n)=pi*n/M;
ritemp(n,round(1000*t+1))=2*cos(beta(n))*cos(Wn(n)*t);
rqtemp(n,round(1000*t+1))=2*sin(beta(n))*cos(Wn(n)*t);
rialpha(1,round(1000*t+1))=2*cos(Wm(i)*t)/sqrt(2);
end
end
ri=sum(ritemp)+rialpha;
rq=sum(rqtemp);
r=sqrt(ri.^2+rq.^2);
mean=sum(r)/2001;
% subplot(3,1,i);
% plot(3,1)
time=0:0.001:2;
plot(time,(10*log10(r)-10*log10(mean)));
titlename=['fd= ' int2str(fm(i)) ' Hz'];
title(titlename);
xlabel('time(second)');
ylabel('Envelope(dB)');
pause
end
2 个评论
Jianning Dong
2019-4-11
I have the same problem here on Linux platform, matlab2019a. Some other functions in the graphics toolbox folder are missing as well.
回答(2 个)
Jianning Dong
2019-4-11
Hi Masroor,
I tried to reset the PATH and rehah the toolbox. Now newplot is usable.
MATLAB moves some functions from the root of graphics folder to axis folder.
So if you update matlab from a previous version. You have to reset the path:
restoredefaultpath
rehash path
rehash toolbox
rehash toolboxcache
2 个评论
daniel bourdon
2019-6-2
I had the same error about variable 'newplot' with Matalb 2019a.
I just typed 'restoredefaultpath' in matlab command window and the plot functions run properly.
David Mellinger
2019-6-17
'restoredefaultpath' worked for me as well. I had done the 'rehash' steps from above previously, which did not work, but possibly the combination of the two is needed.
Abdallah Ghazi Faisal Zaid Alkilani
2020-3-28
I had a similar issue and I think the culprit is a function called newplot.m.
newplot.m function has subfunctions inside that were not terminated with 'end'.
I added an 'end' statement for each function inside newplot.m:
- function axReturn = newplot(hsave)
- function fig = ObserveFigureNextPlot(fig, hsave)
- function ax = ObserveAxesNextPlot(ax, hsave)
It has worked so far *fingers crossed*.
You can open the file to edit by typing >> open newplot;
I hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!