Plots return a blank window

Hi! I wrote a script on matlab2012 but when I run the script on 2014a all of my plots return a blank window. If I however use the brush then I can see the points. Below is an extract from the script. Please help.
for p=pi-B1:0.01:pi
k=sin(2*pi*((p-pi)/B1));
hbiss=hmax*((2*pi)/(B1^2))*k;
h1=hmax*(1+((p-pi)/B1)-((1/(2*pi))*k));
c1=-(m1*(w^2)*hbiss)/(d+h1);
plot(p,c1,'b')
xlabel('psi')
ylabel('c')
title('spring constant')
hold on
end

回答(2 个)

B1=3
hmax=10
m1=10
w=1
d=4
for p=pi-B1:0.01:pi
k=sin(2*pi*((p-pi)/B1));
hbiss=hmax*((2*pi)/(B1^2))*k;
h1=hmax*(1+((p-pi)/B1)-((1/(2*pi))*k));
c1=-(m1*(w^2)*hbiss)/(d+h1);
plot(p,c1,'*b')
hold on
end
xlabel('psi')
ylabel('c')
title('spring constant')

4 个评论

Lee commented
Here are my variables;
B1=(74*pi)/180; %beta 1 [rads]
m1=0.22; %massa 1 [kg]
Nnoll=3000; %[rpm]
hmax=0.003; % hmax [m]
dnoll=0.2; % delta noll [-]
n=(Nnoll/60)*1.2; %varvtalet
w=2*pi*n; %vinkelhstighet
d=dnoll*hmax;
B1=(74*pi)/180; %beta 1 [rads]
m1=0.22; %massa 1 [kg]
Nnoll=3000; %[rpm]
hmax=0.003; % hmax [m]
dnoll=0.2; % delta noll [-]
n=(Nnoll/60)*1.2; %varvtalet
w=2*pi*n; %vinkelhstighet
d=dnoll*hmax;
for p=pi-B1:0.01:pi
k=sin(2*pi*((p-pi)/B1));
hbiss=hmax*((2*pi)/(B1^2))*k;
h1=hmax*(1+((p-pi)/B1)-((1/(2*pi))*k));
c1=-(m1*(w^2)*hbiss)/(d+h1);
plot(p,c1,'.b')
hold on
end
xlabel('psi')
ylabel('c')
title('spring constant')
%or
B1=(74*pi)/180; %beta 1 [rads]
m1=0.22; %massa 1 [kg]
Nnoll=3000; %[rpm]
hmax=0.003; % hmax [m]
dnoll=0.2; % delta noll [-]
n=(Nnoll/60)*1.2; %varvtalet
w=2*pi*n; %vinkelhstighet
d=dnoll*hmax;
p1=pi-B1:0.01:pi;
c1=zeros(size(p1));
ii=0;
for p=p1;
ii=ii+1;
k=sin(2*pi*((p-pi)/B1));
hbiss=hmax*((2*pi)/(B1^2))*k;
h1=hmax*(1+((p-pi)/B1)-((1/(2*pi))*k));
c1(ii)=-(m1*(w^2)*hbiss)/(d+h1);
end
plot(p1,c1,'.b')
xlabel('psi')
ylabel('c')
title('spring constant')
Ok thanks. But why did the window not display anything? The code was the same only the version of matlab was different. The only difference I can see is a dot before "b": I wrote "plot(p,c1,'b')" and you wrote "plot(p,c1,'.b')"
plot([0 1],[1 2],'b')
% What you see in blue is the line between the two points. You can also specify the type of line
plot([0 1],[1 2],'--b')
You can also specify the type of marker
plot([0 1],[1 2],'*--b')
In your case for one point
plot(1,2,'b') % you didn't specify neither type of line(which is impossible because you have one point) nor marker for your point.
plot(1,2,'*b') % for example
For more details read the documentation http://it.mathworks.com/help/matlab/ref/plot.html#btzpm1x

请先登录,再进行评论。

TEJASHREE PAWAR
TEJASHREE PAWAR 2016-11-2
编辑:TEJASHREE PAWAR 2016-11-2

0 个投票

hi , i wrote the following code. but the graph is not plotted. it shows a blank window with just the x and y axes.
clc close all
Rs=2; Vs=10;
for Rl=2:2:20 Is=(Vs/(Rs+Rl)) Il=Is; I=Is; Y=(((Il^2)*Rl)/(Vs*Is))*100 plot(I,Y) hold on end xlabel('I') ylabel('Y')

类别

帮助中心File Exchange 中查找有关 Polygonal Shapes 的更多信息

标签

提问:

Lee
2014-12-11

Community Treasure Hunt

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

Start Hunting!

Translated by