필터 지우기
필터 지우기

Obtain a specif value in a vector

조회 수: 2 (최근 30일)
Giuseppe Pintori
Giuseppe Pintori 2019년 10월 22일
댓글: Giuseppe Pintori 2019년 10월 22일
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
Adam
Adam 2019년 10월 22일
Nothing changes in that while loop though!
Giuseppe Pintori
Giuseppe Pintori 2019년 10월 22일
Exactly

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by