the graph is empty, how can i solve this,(there are lot of constant values)

조회 수: 6 (최근 30일)
paripavithran sampathu
paripavithran sampathu 2016년 9월 6일
댓글: Rena Berman 2017년 1월 20일
clc;
clear all;
close all;
syms q1 q2 q3 q4 qt1 qt2 qt3 qt4 m1 m2 m3 m4 l1 l2 l3 l4 h1 h2 h3 h4 g x
syms I1 I2 I3 I4 Q1 Q2 Q3 Q4 qtt1 qtt2 qtt3 qtt4 t real
l1=270*10^-3;
l2=230*10^-3;
l3=198*10^-3;
l4=50*10^-3;
g=9.80665;
m1=23.687;
m2=17.15;
m3=2.0125;
m4=0.4179;
h1=765*10^-3;
h2=568*10^-3;
h3=418*10^-3;
h4=220*10^-3;
I1=0.099379;
I2=0.050526;
I4=0.000405;
I3=0.000702;
k1=(1/3)*(m1*l1^2*qt1^2);
k2=0.5*m2*((qt1^2*l1^2)+(0.25*qt2^2*l2^2)+(qt1*qt2*l1*l2*cos(q2)))+(0.5*I2*qt1);
k3=0.5*m3*((qt1^2*l1^2)+(qt3^2*l2^2)+(2*qt1*qt3*l1*l2*((qt1^2)+(qt1*qt2))*cos(q2)))+(0.5*I1*qt1^2)+(0.5*I2*(qt1+qt2)^2);
k4=(0.5*m4*l4^2*qt4^2);
p1=m1*g*h1;
p2=m2*g*(h1-h2);
p3=m3*g*(h1-h2-(0.5*q3));
p4=m4*g*(h1-h2-q3-(h4*0.5));
k=k1+k2+k3+k4;
p=p1+p2+p3+p4;
L=k-p;
for x=0:1:10
q1=3-(3*cos(pi*x/10));
qt1=3*sin(pi*x/10)*pi/10;
qtt1=3*cos(pi*x/10)*(pi^2/100);
q2=3-(3*sin(pi*x/10));
qt2= -3*cos(pi*x/10)*(pi/10);
qtt2=3*sin(pi*x/10)*(pi^2/100);
qt3=0.198*x^2;
qtt3=0.198*x;
qtt4=sin(x)+cos(x);
Lqt1 =I2/2 + I1*qt1 + (m2*(2*qt1*l1^2 + l2*qt2*cos(q2)*l1))/2 + (m3*(2*l1^2*qt1 + 2*l1*l2*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*cos(q2)*(2*qt1 + qt2)))/2 + l1*l2*m3*qt1^2*qtt2*cos(q2) - l1*l2*m3*qt1*qt2*sin(q2)*(qt1^2 + qt2*qt1);
Ldt4 =l4^2*m4*qtt4;
Q1 = Ldt1 - Lq1
% Q2 = Ldt2 - Lq2
% Q3 = Ldt3 - Lq3
% Q4 = Ldt4 - Lq4
plot(x,Q1)
hold on
end
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 9월 7일
Well, we aren't going to be able to help you further without a copy of your code.
Rena Berman
Rena Berman 2017년 1월 20일
(Answers Dev) Restored Question.

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 7일
You are using plot() with scalar x and scalar Q1, rather than vectors, so you are drawing a bunch of points, not a line. The default for plot() is to use no marker, so the points you draw are all invisible. You need to add a marker specification to the plot() call, or else you need to record the x values and the Q1 values as you go through the loop instead of plotting, then after the loop plot() them all at one time to get a line.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by