フィルターのクリア

plotting

10 ビュー (過去 30 日間)
mohamed saber
mohamed saber 2011 年 10 月 21 日
コメント済み: Mohammed Anveez 2020 年 5 月 16 日
i've a problem in this code ... there isn't any output graph .. i don't know why ???
for t=0:.00001:1;
n=n+1;
x1=2.5*cosd(10*pi*t);
x2=2*cosd(8*pi*t);
x1(n)=x1;
x2(n)=x2;
end
plot(t,x1)
hold on
plot(t,x2)
  1 件のコメント
Jan
Jan 2011 年 10 月 21 日
Please use code formatting as explained in the "Markup help" link.

サインインしてコメントする。

採用された回答

Robert Cumming
Robert Cumming 2011 年 10 月 21 日
your plotting your vector x1 against a scalar value of t.
Change your code to:
figure
plot([0:.00001:1],x1)
hold on
plot([0:.00001:1],x2)
  2 件のコメント
Jan
Jan 2011 年 10 月 21 日
Adding unnecessary square brackets around a vector wastes time. "0:00001:1" is a vector already.
Robert Cumming
Robert Cumming 2011 年 10 月 21 日
True - they are unnecesary...
Do you mean computational time or typing time?
I originally started doing it as I (personally) think its more readable...
Now I do it without thinking about it - maybe its a bad habit - but they are the hardest to break... ;)

サインインしてコメントする。

その他の回答 (5 件)

Andrei Bobrov
Andrei Bobrov 2011 年 10 月 21 日
t=0:.00001:1;
plot(t,2.5*cosd(10*pi*t))
hold on
plot(t,2*cosd(8*pi*t))
or
plot(t,[2.5*cosd(10*pi*t),2*cosd(8*pi*t)])
  1 件のコメント
Mohammed Anveez
Mohammed Anveez 2020 年 5 月 16 日
even iam facing same issue in plotting

サインインしてコメントする。


mohamed saber
mohamed saber 2011 年 10 月 21 日
thanks to all

AR
AR 2017 年 3 月 21 日
How can I plot the my Liklihood function for a large n, say at 100, to show max? fplot did not work.
L_theta=1/16*((1+x1*theta)*(1+x2*theta)*(1+x3*theta)*(1+x4*theta))
fplot(L_theta,[-1,1])
I used the iterative Newton method to solve via convergence to theta_MLE and would like to graphically display this as well.
Anyone have a suggestion?
Thank you.

Pawello85
Pawello85 2018 年 11 月 6 日
Hello. I have a small problem to generate a higher resolution plot.
fs=1000; t=0.075:1/fs:0.225; fi=0; A=0.5; f=10:190/150:200; w=2*pi*f; x=A*cos(w.*t+fi); figure plot(t,x); xlabel('t [s]'); ylabel('Amplitude');

carlos ruiz
carlos ruiz 2019 年 12 月 1 日
Hello i have s problem with this code i can not plot very well this vector
clc
clear
syms L real
T=[5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]';%Periodos segundos
d=[5 10 30 50 80 100 200 1000 2000];%Tirante de agua profundidad
w=(2*pi./T).^2;
g=9.81;
for i=1:21
for d=1:9
K=2*pi/L;
f=g*(K)*tanh(K*d(1))-w(i);
Ls(i)=solve(f,'L')
Lss=eval(Ls')
end
end
y=abs(Lss)
grid on
hold on
plot(T,y,'r');
xlabel('Wave period T (sec)'); %Titulo del eje X
ylabel('Wave length'); %Titulo del eje Y
title('The dispersion relationship gives the relationship between wave period and wave length For linear waves in finite water depth d'); %Titulo del gráfico

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by