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 Comment

To test your code we need the values of your variables

Sign in to comment.

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 11 Dec 2014
Edited: Azzi Abdelmalek on 11 Dec 2014
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 Comments

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

Sign in to comment.

TEJASHREE PAWAR
TEJASHREE PAWAR on 2 Nov 2016
Edited: TEJASHREE PAWAR on 2 Nov 2016
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')

Categories

Tags

Asked:

Lee
on 11 Dec 2014

Edited:

on 2 Nov 2016

Community Treasure Hunt

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

Start Hunting!