How to use put multiple points in same equation? 'Error using vercat'

조회 수: 1 (최근 30일)
rajdeep singh
rajdeep singh 2020년 2월 9일
댓글: Walter Roberson 2020년 2월 9일
a=1; b=2; x= [x1,x2,x3,x4....x20];%all random values c=(a+b)/(b+x); plot (x,c);

답변 (1개)

Walter Roberson
Walter Roberson 2020년 2월 9일
You need ./ instead of /
  댓글 수: 2
rajdeep singh
rajdeep singh 2020년 2월 9일
Sorry sir but its all about the x has multiple values and i want to get results by putting all of them in same code. Matlab is not showing results by the above code. Showing 'error using vercat'
Walter Roberson
Walter Roberson 2020년 2월 9일
The ... continuation operation that you are using makes the entire rest of the line into a comment. The entire rest of your code is on the same line after that point, so the entire rest of your line is a comment. MATLAB is going to give you an error about the unclosed [ before it gives you a vertcat error.
If you were not using ... then you would have the problem that your % comments out the rest of its line, which is the rest of your code.
With the code structure you are using, your x* variables all need to have the same number of rows. You might have to reshape() some of them into a vector. In some cases you might be able to get away with using the .' transpose operator. You could also use the shortcut NAME(:).' to get a row vector.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by