Plots return a blank window
Afficher commentaires plus anciens
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 commentaire
Azzi Abdelmalek
le 11 Déc 2014
To test your code we need the values of your variables
Réponses (2)
Azzi Abdelmalek
le 11 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 11 Déc 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 commentaires
Azzi Abdelmalek
le 12 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 12 Déc 2014
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
le 12 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 12 Déc 2014
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
le 12 Déc 2014
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
le 12 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 12 Déc 2014
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
TEJASHREE PAWAR
le 2 Nov 2016
Modifié(e) : TEJASHREE PAWAR
le 2 Nov 2016
0 votes
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')
Catégories
En savoir plus sur Polygonal Shapes dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!