Jump to content

MATLAB Help


redsox

Recommended Posts

Those who are proficient in MATLAB, can you please help with this problem. I am trying to execute the following code but I keep getting this message:

R1=4


R2=4


G=[.25 -.25 0;-.25 .50 0;1 0 0]


Gin=inv(G);




for t=0:.005:1


	{




		Vs =[0;0;(10*sin(7*t))];


		B=[0;0;Is];


		I=[(Vs/R1) 0 0];


		V=(I+B)*Gin;


		end


		}
The error message I get is this:
??? Error: File: A2.m Line: 11 Column: 12


The expression to the left of the equals sign is not a valid target for an assignment.

Can someone please help me in regards to this. I am actually in a hurry. Thank you.

Link to comment
Share on other sites

I don't know what MATLAB is, much less what that code does, but you have a space after the "Vs" property where the others don't have spaces. Other than that, the error sounds as if it's something that's not been declared properly - like if you haven't specified what R1, for example, is.

Link to comment
Share on other sites

I was able to find out what the problem was. The code inside the for-loop should not be inside the parenthesis.

FYI - MATLAB is an expensive software that mainly utilizes MATRIX to solve problems. It has a hell of a lot of features. I am using it for college (Electrical Engineering major) and just started using them. Seems pretty interesting even though I hate coding.

Link to comment
Share on other sites

you can't have a number in the file name. take the number out and rename the file to something like 'atwo' or 'anew' or something

well, nmind if that fixed the problem. when i had to use matlab we could never have a number in the filename.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...