I have actually a duty VanderPol() i m sorry is claimed to offer a vector output, however it doesn"t seem come work. That is simply three lines of code but I cannot seem to uncover the bug.

The function is

function = VanderPol(y, i) calculation = ;endand it is dubbed as

z = <1 2 3; 4 5 6>;VanderPol(z,1)I recieve one error blog post stating that VanderPol(z,1) is faulty, yet no hint why. The precise error article is displayed below. Can anyone point out the bug?

Error using vertcatDimensions that arrays being concatenated space not consistent.


You are watching: Dimensions of matrices being concatenated are not consistent. matlab

matlab
share
boost this question
monitor
edited Sep 5 "19 at 11:22

*

hbaderts
13.5k44 yellow badges3737 silver- badges4444 bronze badges
inquiry Sep 5 "19 in ~ 8:20
*

SimpleProgrammer SimpleProgrammer
24922 silver- badges88 bronze badges
2
add a comment |

1 answer 1


energetic earliest Votes
7


See more: How To Watch Auburn Vs Alabama A&Amp;M Score, Instant Analysis: No

This is a little of an leaf case: You have the right to construct arrays in MATLAB by separating elements either through a comma , or a room . Thus, the following ways both work and give the same result:

a = <1, 2, 3>b = <1 2 3>When building matrices, this works similarly, and rows are separated by a semicolon or a brand-new line, i.e. We have the complying with equivalent possibilities:

A = <1, 2, 3; 4, 5, 6>B = <1 2 3; 4 5 6>C = <1, 2, 3 4, 5, 6>D = <1 2 3 4 5 6>Now to your example: your variety is the following:

The very first row includes one element y(2,i). The 2nd row, however, is taken as two elements: (1-y(1,i)^2)*y(2,i) and -y(1,i), because of the space between this parts. I.e. MATLAB thinks you are using a space to separate two components of range like in b above. The interprets the input like the following:

If you dough the code right into MATLAB, you will thus obtain an error complaining the it is not possible to have variety with 1 element in the an initial and 2 aspects in the second row:

output = ; % spaces ~ above both political parties of -output = ; % no spaces approximately -output = ; % parentheses about everything