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

댓글 수: 1

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 11일
To test your code we need the values of your variables

댓글을 달려면 로그인하십시오.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 11일
편집: Azzi Abdelmalek 2014년 12월 11일

0 개 추천

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

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 12일
편집: Azzi Abdelmalek 2014년 12월 12일
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;
Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 12일
편집: Azzi Abdelmalek 2014년 12월 12일
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')
Lee
Lee 2014년 12월 12일
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')"
Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 12일
편집: Azzi Abdelmalek 2014년 12월 12일
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일

편집:

2016년 11월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by