How i merge these two equations ?

조회 수: 1 (최근 30일)
Ian Samuelsson
Ian Samuelsson 2019년 6월 12일
댓글: Walter Roberson 2019년 6월 12일
clearvars;
% X=xv = Aceleração
% Y=yv = Massa
%Z = força
xv = linspace(0, 2 );
yv = linspace(0,2 );
[X, Y] = ndgrid(xv, yv );
Z = X.*Y;
surf(X, Y, Z, 'edgecolor', 'none ');
xlabel('Massa');
ylabel('Aceleração');
zlabel('z');
xv2 = linspace(0, 3 );
yv2 = linspace(0,3 );
[X, Y] = ndgrid(xv2, yv2 );
Z = sqrt(2*X*Y);
surf(X, Y, Z, 'edgecolor', 'none ');
xlabel('Gravidade');
ylabel('Raio');
zlabel('z');
  댓글 수: 4
Rik
Rik 2019년 6월 12일
You have two equations:
Z=X.*Y;
Z=sqrt(2*X*Y);%note: this is not element-wise!
How would you propose to make it one equation? They are only the same when they are 0. Do you want to have one function apply to one range of x and y and the other to the rest? If so, what are the edges?
Walter Roberson
Walter Roberson 2019년 6월 12일
perhaps you just need to add
hold on
after the first surf() ?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by