how can i write function with the picture which i attached to the question?

2 次查看(过去 30 天)
hey people
have a good time
i have a problem over the function which i attached to this Question.
i would like to write the function which take 2 variables (e.g. t and o)
and compute rmse and r^2 coefficient
can you help me out over this problem?
  2 个评论
Geoff Hayes
Geoff Hayes 2021-6-23
hadi - what have you tried so far? Please describe what you have attempted and discuss what problem or errors you are experiencing with your code.
hadi me
hadi me 2021-6-23
I've tried 2 version of this problem
one of that, is:
function [term1 , term2] = stat(o , t)
term1=...
term2=...
end
but it didn't work
I would like to compute the error from 2 rows of input data
I have problem with matlab code.
can you help me?

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2021-6-23
Here's some help:
Also check out the sum() and sqrt() functions. To square, use the caret:
term1 = sum(O) ^ 2
Multiplication is * and division is /. Not hard. Just take it one term at a time:
term1 = ....
term2 = ....
denominator = ....
rSquared = ( (term1 - term2 * term3) / denominator) ^2
Or you can simply use the built in functions for mse() and corrcoef().
  1 个评论
Image Analyst
Image Analyst 2021-6-23
Sure we can help you but all you gave was a partial snippet of one of your attempts, which was just a partial snippet of my answer above:
function [term1 , term2] = stat(o , t)
term1=...
term2=...
end
It seems you forgot to upload your entire two code attempts so how can I comment on them? So I guess my answer stands as-is until you upload your code. Come on, you can do it, you're a smart engineer. It sounds like homework, and if so I'm sure your instructor didn't just say "See if someone in the Answers forum can do your homework problem for you."

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by