You have not given us sufficient information to know anything about your problem.
You did not tell us what VcO is. Is it a number, a scalar? Is it a vector? WHAT IS IT?
My guess is either:
- VcO is causing the problem, that you have defined it somehow as a vector or matrix of some unknown size, and you do not realize that, or...
- You tell us that E, R , and C are entered by the user, but you do not show us HOW they are input. Too often when I see this done by a novice, they do not realize that they have entered CHARACTER versions of a number. For example, '123' is NOT the number 123 in MATLAB. It is an ascii representation, composed of 3 bytes of information, not the double precision number 123.
The point I am making is that often when novice enters a number, they do not realize that in fact, they entered a character representation of that number. In that case, that variable will be an ascii string, but not a number itself. It will be a vector, so when you try to multiply one vector by another, matlab gets confused when one of them is a string, and a vector of the wrong size! This could explain the error message that you got.
So again, I don't know, nor can I know what you have done wrong. And when code LOOKS reasonable as it is written, then that almost always means that one or more of the variables is not as you tell us it is, not what you think the variable is. So that is what you must check.
You can fix it trivially though, by carefully looking at each variable in this block of code. Execute each line at a time. Look at what you get. Is it the size and shape you expect? Use the functions who and whos. The workspace tab will also tell you this information. What do they tell you about your variables? Are the numbers as you expect to see? If not, where does the error occur?
If necessary, respond by showing the result of whos. Are all the variables that you THINK are scalars really scalar variables? Are they all of double class?
Learn to debug your code, by learning to look critically at each line, at each variable. Does the code do what it should do?