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
2014 年 12 月 11 日
To test your code we need the values of your variables
回答 (2 件)
Azzi Abdelmalek
2014 年 12 月 11 日
編集済み: Azzi Abdelmalek
2014 年 12 月 11 日
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
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
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
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
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
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 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!