## how to numerically define 1/x^2+0.4/(60-x)^2

Matthew Aranda Weale

### Matthew Aranda Weale (view profile)

님이 질문을 제출함. 2 Nov 2019
최근 활동 John D'Errico

### John D'Errico (view profile)

님이 편집함. 2 Nov 2019
trying to define I= 1/x^2+0.4/(60-x)^2 numerically but says matrix dimensions must agree so incorrect use of /
help

로그인 to comment.

## 답변 수: 2

### KALYAN ACHARJYA (view profile)

on 2 Nov 2019
Edited by KALYAN ACHARJYA

### KALYAN ACHARJYA (view profile)

on 2 Nov 2019

x=10; %define x, here is just an example
I=1/x^2+0.4/(60-x)^2

로그인 to comment.

### John D'Errico (view profile)

on 2 Nov 2019
Edited by John D'Errico

### John D'Errico (view profile)

on 2 Nov 2019

If x is a vector or array, then you are trying to compute element-wise operations. But / and ^ and * are all operators that are defined in terms of MATRIX multiplies and linear algebra.
Use the ./ .^ and .* operators for element-wise operations.
I= 1./x.^2+0.4./(60-x).^2
Ideas like this would be found in the getting started tutorials for MATLAB. Essenitally, it is always a good idea to read the manual.

로그인 to comment.

Translated by