Problem with multivariable plots

2 ビュー (過去 30 日間)
cTroels
cTroels 2020 年 2 月 21 日
回答済み: ashkan mohammadi 2020 年 2 月 28 日
How do i plot the same function with different values of a constant in a plot?
I have a function, with 2 variable inputs and 2 outputs. I plotted it where i keep the one variable constant, and now i want to plot it keeping the other variable constant, but for multiple values af a constant. Heres the function:
[Gamma, Beta] = Vinkel(n, tid)
n = 1:365;
tid = 0;
Omega = 15*tid;
Phi = 56.3;
Delta = 23.45*sind(360*(284+n)/365;
Theta_z = acosd(cosd(Phi)*cosd(Delta)*cosd(Omega)+sind(Phi)*sind(Delta));
%Sign_Omega gives 1 if Omega is positive and -1 if Omega is negative.
Gamma = Sign_Omega(Omega)*(acosd((cosd(Theta_z)*sind(Phi)-sind(Delta))/(sind(Theta_z)*cosd(Phi))))
Figure
plot(n,Theta_z)
Now i want to plot Gamma and Theta_z for tid = -12:12 for n = 171 and 356.

採用された回答

Samatha Aleti
Samatha Aleti 2020 年 2 月 25 日
Hi,
According to my understanding you are trying to plot each output “Gamma” and “Theta_z” by changing 2 inputs “tid and “n”. You can do so by using “hold on. Here is a sample code:
tid = 2:2:8; % Let
n = [1 4]; % Let
Theta_z = tid.*n(1); % Let: for 1st value of n
plot(tid,Theta_z);
hold on
Theta_z = tid.*n(2); % Let: for 2nd value of n
plot(tid,Theta_z);
legend('n = 1','n=4');
hold off

その他の回答 (1 件)

ashkan mohammadi
ashkan mohammadi 2020 年 2 月 28 日
how do i plot this multivariable equation : ax^3-bx^2+3x(3-i^2)-1+i^2
i tried to used polynomial for finding the root of this above equation but i got matlab error..
in fact i'm gonna find x for different value of i, and then plotting x versus i ????

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by