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 个评论
Guillaume
Guillaume 2019-4-4
Comment by Bruno Brito mistakenly posted as an Answer:
I am getting the same problem
Jianning Dong
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
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
daniel bourdon 2019-6-2
The Answer by Jianning Dong works very well.
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
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
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.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by