how to plot surface for this problem.

조회 수: 1 (최근 30일)
Nitish Chopra
Nitish Chopra 2018년 5월 14일
댓글: Nitish Chopra 2018년 5월 14일
a=[ 0.042 0.056 0.082]
b=[45 50 56]
c=[10 15 35]
Xmin=[ 10 45 60]
Xmax=[ 100 200 150]
F=a*X^2 +b*X+c
how to plot surface( visualize) for "F" function versus X for different values of X over different iterations

답변 (2개)

KSSV
KSSV 2018년 5월 14일
a=[ 0.042 0.056 0.082] ;
b=[45 50 56] ;
c=[10 15 35] ;
Xmin=[ 10 45 60] ;
Xmax=[ 100 200 150] ;
n = length(a) ;
N = 100 ;
F=@(a,b,c,X) a*X.^2 +b*X+c ;
figure
hold on
for i = 1:n
x = linspace(Xmin(i),Xmax(i),N) ;
[X,Y] = meshgrid(x,x) ;
Fi = F(a(i),b(i),c(i),X) ;
surf(X,Y,Fi) ;
end
  댓글 수: 2
Nitish Chopra
Nitish Chopra 2018년 5월 14일
thanks for reply, but it didn't served the purpose. i am expecting output like this figure
Nitish Chopra
Nitish Chopra 2018년 5월 14일
data=[0.03546 38.30553 1243.5311 35 210 0.02111 36.32782 1658.5696 130 325 0.01799 38.27041 1356.6592 125 315]; a1=data(:,1); b1=data(:,2); c1=sum(data(:,3)); Pmin=data(:,4)';%/*lower bounds of the parameters. */ Pmax=data(:,5)';
F=P1.*P1*a1+P1*b1+c1;
these are values of F which I got after 10 iterations F=[25473.6648344552 25469.7808522268 25466.1716596841 25466.1716596841 25466.1716596841 25466.1716596841 25466.1716596841 25466.1716596841 25466.1716596841 25466.1147025374] how can I visualize F=P1.*P1*a1+P1*b1+c1; in surface

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


Aakash Deep
Aakash Deep 2018년 5월 14일
I am assuming that your matrix X has a dimension nx3 where n can be your iterations. After executing your function command F=a*X^2 +b*X+c this will produce F with the same dimension as X. Now you can plot it using the surface plot command surf(F). I hope this will help.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by