importing the excel data into matlab in symbolic math tool

i have used symbolic math tool box to find out the variable in the equation. i have imported the data from the excel file to matlab.but i am not getting the result.

Réponses (2)

Walter Roberson
Walter Roberson le 15 Jan 2021
Your X is a vector with four elements. When you use it in the equations you are creating a system of four simultaneous equations. You then ask solve to find a single N value that solves all of the equations simultaneously.
solve() is not vectorized: it is simultaneous solutions only.

9 commentaires

How can I rectify this error ?? I am new to matlab ...
Walter Roberson
Walter Roberson le 15 Jan 2021
Modifié(e) : Walter Roberson le 15 Jan 2021
loop so that you only work with one set of data at a time.
Sometimes what you want is not one solution for each set of data. Sometimes what you want is a single solution that fits the data the best. In such a case you can use curve fitting or nonlinear least squares to try to find the best fit. You would want to use matlabFunction to generate the functions that be the model to fit against.
Can u tell me how to write the code ??
Paste your existing code and I will show you the revised version. I do not want to have to type in your code from the picture of the code. I cannot run pictures of code.
clear all
close all
syms N
N_arraydata=xlsread('suspended.xlsx')
Qo=xlsread('suspended','Sheet1','A2:A5')
R=xlsread('suspended','Sheet1','B2:B5')
No=xlsread('suspended','Sheet1','C2:C5')
X=xlsread('suspended','Sheet1','F2:F5')
r=(No-N)/No
V=2435
k=1.076
a=0.27
Solution=solve(0==Qo*(1+R)*(No-N)*r-V*((X*k*N)/(a+N)),N);
vpa(Solution)
syms N
Qo = xlsread('suspended','Sheet1','A2:A5')
R = xlsread('suspended','Sheet1','B2:B5')
No = xlsread('suspended','Sheet1','C2:C5')
X = xlsread('suspended','Sheet1','F2:F5')
r = (No-N)./No;
V = 2435;
k = 1.076;
a = 0.27;
nX = size(X,1);
solutions = cell(nX,1);
for S = 1 : nX
solutions{S} = solve(Qo(S) .* (1+R(S)) .* (No(S)-N) .* r(S) - V*((X(S)*k*N)./(a+N)), N);
vpa(solution{S})
end
celldisp(solutions)
I used a cell array instead of a plain array because I did not want to assume that there would always be exactly one solution -- the code assumes that there might possibly be no solution, or multiple solutions.
Thank you
Here I am getting the result some what higher compared to manual calculations.and if I change the data, I am getting only one value for four outputs.
We do not have your data to test with. We also do not know what your manual calculations came out as.

Connectez-vous pour commenter.

i have written the code for individual data to crosscheck that my getting the correct values or not .
i am attaching my code below and i am sending excel file .can u help me where i did mistake
clear all
close all
syms N
Qo=xlsread('suspended','Sheet1','A3')
R=xlsread('suspended','Sheet1','B3')
No=xlsread('suspended','Sheet1','C3')
X=xlsread('suspended','Sheet1','F3')
V=2434.67
r=(No-N)/No
k=1.076
a=0.27
Solution=solve(0==Qo*(1+R)*(No-N)*r-V*((X*k*N)/(a+N)),N);
vpa(Solution)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by