Question
Hello, I want to solve the following equation: 1/c0 c^2 - c +X*t / c0 = 0 where c0 is a given constant but X and t are constant arrays: they are data sets where X varies with time, t. The goal is to solve for c, which too will be a data array that varies with time, t. I tried: func = @(c) 1/c0.*c^2 - c + X.*t/c0; c = fzero(func,1) But got errors likely because X and t are arrays and not single values. Any other ideas? Time sensitive, thank you!!!
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 23, 2026
You have c^2 and say that c will be an array.
Could you confirm that you c^2 meaning c*c meaning algebraic matrix multiplication (inner product) of c with itself?
If you do then all of the values have to be searched for simultaneously, which makes it a multivariate problem, but fzero() can only be used for univariate situations. fsolve() can be used for multivariate cases.
Also is X*t intended to be algebraic matrix multiplication like in your problem definition, or is it X.*t like in your code?
XTc0 = X.*t./c0; c = arrayfun(@(xtc0) fsolve(@(c) 1/c0.*c.^2 - c + xtc0), XTc0)
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →