i want to solve X+Y+Z=10 and 0<x<10, 0<y<10, 0<z<10 want each combination value of x,y and z in full digit

조회 수: 9 (최근 30일)
for value of x,y and z satisfy that equation and x, y and z in this range and answer in full digit in matlab than give answer in matlab code

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 21일
You do not have enough memory on your computer to store all of the combinations. There are 4607182418800017407 distinct values that can be represented in the range 0 <= x < 1 alone.
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 11월 21일
meshgrid or https://www.mathworks.com/help/matlab/ref/ndgrid.html . Sum the three, use a logical test to determine the locations that match.
What you would do after that depends on the form of output you need, which you did not mention.

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

추가 답변 (1개)

KSSV
KSSV 2016년 11월 21일
x = 0:10 ;
y=x ;
z = x ;
[X,Y,Z] = ndgrid(x,y,z) ;
thesum = X+Y+Z ;
% get equal to 10
idx = thesum==10 ;
iwant = [X(idx) Y(idx) Z(idx)]

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by