need solution during trainning

160 ビュー (過去 30 日間)
NABARUN MAIKAP
NABARUN MAIKAP 2020 年 5 月 11 日
コメント済み: Kalagatla 2024 年 1 月 25 日
この 質問 は Walter Roberson さんによってフラグが設定されました
Hello all, I am new in this community .I need help to solve the below problem. please help me..
statement : You can add a custom function at the end of your script. For data preprocessing, the function should take the data returned from the datastore as input. It should return the transformed data as output.
function dataout = functionName(datain)
% do something with datain
dataout = ...
end
Given script :
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
Task ; -
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won't run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task.

回答 (10 件)

VISHAL
VISHAL 2020 年 5 月 30 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  1 件のコメント
Manoj Kumar M
Manoj Kumar M 2020 年 5 月 31 日
is write answer

サインインしてコメントする。


Ravi kumar
Ravi kumar 2020 年 5 月 13 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
data = scale(data);
  1 件のコメント
DGM
DGM 2023 年 4 月 25 日
Contrary to the instructions, this code performs all the tasks of the scale() function inline. Despite obviating the function call (and implementing no function), the nonexistent scale() function is still called, and it's called in a place where it would accomplish nothing even if it worked.
What's the point in posting answers that are demonstrably wrong?

サインインしてコメントする。


Hessel
Hessel 2020 年 6 月 1 日
you should put the "sacle" function at the end
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
preprocds = transform(letterds,@scale)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  1 件のコメント
BRAJ KISHOR VERMA
BRAJ KISHOR VERMA 2020 年 6 月 2 日
show wrong result

サインインしてコメントする。


Ali Al-nuaimi
Ali Al-nuaimi 2020 年 6 月 12 日
preprocds = transform(letterds,@scale)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  2 件のコメント
Logesh B
Logesh B 2022 年 1 月 1 日
answer is wrong
Prayas
Prayas 2022 年 9 月 15 日
answer is wrong sir please solve it

サインインしてコメントする。


L.J.
L.J. 2020 年 6 月 13 日
data = readall(preprocds);
plot(data.Time, data.Y)
The first line of code needs to be surpressed, so just be sure to add a ; to solve the issue :) good luck
  2 件のコメント
JAMES S
JAMES S 2020 年 8 月 1 日
Not solviing
구룽
구룽 2022 年 10 月 2 日
task 2 says it's incorrect :(

サインインしてコメントする。


Abdul Aziz Hisham Shubbak
Abdul Aziz Hisham Shubbak 2021 年 4 月 19 日
last all ::
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end

Rhonnel S. Paculanan
Rhonnel S. Paculanan 2022 年 6 月 8 日
移動済み: DGM 2023 年 4 月 25 日
TASK 1
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
TASK 2
preprocds =transform( letterds , @scale ) % directly process the data storage
% Read all processed data
data =readall( preprocds );
plot( data . Time , data . Y )
TASK 3
preprocds = transform(letterds,@scale)
data = readall(preprocds)
plot(data.Time,data.Y)
TASK 4 (erase the content of Tasks 1 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end
TASK 5 (erase the content of Tasks 4 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X,"omitnan");
data.Y = data.Y - mean(data.Y,"omitnan");
end
  1 件のコメント
Luis
Luis 2023 年 7 月 16 日
Thank you very much!

サインインしてコメントする。


Md. Hasnat Karim
Md. Hasnat Karim 2023 年 2 月 15 日
put the scale function at the end of the script below the title "Tasks 1, 4, 5 ".
function data=scale(data)
data.Time=(data.Time-data.Time(1))/1000;
data.X = 1.5*data.X;
end
and write the following code for task 2
preprocds = transform(letterds,@scale)
  2 件のコメント
MAHESH BABU
MAHESH BABU 2023 年 8 月 26 日
task 2 code error
Kalagatla
Kalagatla 2024 年 1 月 25 日
task 2 erroe

サインインしてコメントする。


Srivikasheetha
Srivikasheetha 2023 年 7 月 19 日
編集済み: Walter Roberson 2023 年 8 月 26 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
% Your existing code
plot(data.X, data.Y)
axis equal
plot(data.Time, data.Y)
ylabel("Vertical position")
xlabel("Time")
% Define the custom function 'scale'
function dataout = scale(datain)
% Perform the operations on the input datain
datain.Time = (datain.Time - datain.Time(1)) / 1000;
datain.X = 1.5 * datain.X;
% Assign the transformed datain to dataout
dataout = datain;
end
% Call the scale function and assign the output to 'scaled_data'
scaled_data = scale(data);

RAMAKANT
RAMAKANT 2023 年 8 月 24 日
TASK
Create a function called scale at the end of the script that performs these operations:
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function must use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won't run until this function has been created.
Also note that local functions must be at the end of a script. This means you must edit the script sections out of order in this activity. The section headings in the script show which section of the script to edit in each task.
what is answer given task
  1 件のコメント
DGM
DGM 2023 年 8 月 24 日
Your question is already answered above.
The course itself will also give you hints and solutions if you click on the links.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by