Azzera filtri
Azzera filtri

Obtain a specif value in a vector

2 visualizzazioni (ultimi 30 giorni)
Giuseppe Pintori
Giuseppe Pintori il 22 Ott 2019
Commentato: Giuseppe Pintori il 22 Ott 2019
Hi guys, I'm having a problem; let's say I have a code like the following:
clear
g = ones(1,1);
serv = (randi([0, 10], [10,10])).*g;
meanserv = mean(serv);
At this point, what I need is a value of g such that meanserv(1,1) is equal to 0.3 and meanserv(1,10) is equal to 0.7; I was thinking to use an fsolve or a simple while/if but I can't figure out how to obtain those results.
Thanks in advance.
  4 Commenti
Adam
Adam il 22 Ott 2019
Nothing changes in that while loop though!

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by