Surface Plot or Mesh Plot
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
I am quite naive to MATLAB, so i beg your apology for asking simple questions. Here is the code:
A=50;
tau=1;
P_f=0.02;
for i=1:100
v0(i)=i;
v(i)=v0(i).*5/18;
Kf=tan(atan((v(i).*tau)/sqrt((4*A^2)-((v(i)^2)*(tau^2))))-((pi*P_f)/2));
M=(2*A*Kf)/(v(i).*sqrt(1+Kf^2));
Phf(i)=(2/pi)*(atan((v(i).*tau)/sqrt((4*A^2)-(((v(i))^2)*tau^2)))-atan((v(i).*M)/sqrt((4*A^2)-(((v(i))^2)*M^2))));
end
plot (v0,Phf)
Now, how to make a Surface Plot or Mesh Plot of this ?
6 Kommentare
Azzi Abdelmalek
am 13 Jul. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Jul. 2014
You need three variables. What are they?
Adnan
am 13 Jul. 2014
Star Strider
am 13 Jul. 2014
Which other one do you want to plot: Kf, M, or something else?
Adnan
am 13 Jul. 2014
Star Strider
am 13 Jul. 2014
When I calculated your data, the range (max(Phf)-min(Phf)) = 69.3889e-018. The variations in Phf are on the order of machine precision.
Do this calculation (dPhf/dv0) and plot to illustrate that:
dPhfdv0 = diff([Phf])./diff([v0]);
plot(dPhfdv0)
Adnan
am 14 Jul. 2014
Antworten (1)
Star Strider
am 14 Jul. 2014
Probabilities are by definition always positive.
I used dPhfdV0 to illustrate the fact that your Phf array has very little variation. If you want to calculate the statistics, I would calculate those on Phf itself. Calculating the mean and standard deviation are easy enough:
Phfmn = mean(Phf)
Phfsd = std(Phf)
If you want the values that will define the range that Phf will be found within with 95% probability, you can calculate them as:
PhfRng95 = [Phfmn-1.96*Phfsd Phfmn+1.96*Phfsd]
You have to use format long e to see the details of PhfRng95. The value of 1.96 is the inverse normal distribution for the probabilities of 0.025 and 0.975, encompassing a total probability of 0.95.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!