samedi 29 novembre 2014

Plotting an equation with two input variables using meshgrid() in MATLAB - matrix incompatibility


Vote count:

0




I am trying to plot a 3D graph of an equation that has two input variables: time, t and spring constant, K in order to investigate the effect of K on the output. I have looked in to how to plot a function with two input variables using meshgrid() and converting the two inputs into compatible matrices.


For multiplying one of those inputs, say 't'. The multiplication sign needs to be preceded by '.' e.g y = t.*C (where C is some constant). For two inputs it is the same; e.g y = t.*C + K.^2.


However I cannot find how to do that for division, if the variable is in the numerator I assume you can simply write the expression as say: t*1/C. However how do you write it when the variable is in the denominator as in 'C/t'. I have tried placing '.' after 't' in the denominator however I get an error:



Error using /

Matrix dimensions must agree.



Also do I need to put the '.' after the variable in an addition?


Apologies if all this seems vague. I can put in the actual equation however it extremely long and it works when only t is a variable and K is a constant so the equation itself is sound.



asked 35 secs ago







Plotting an equation with two input variables using meshgrid() in MATLAB - matrix incompatibility

Aucun commentaire:

Enregistrer un commentaire